Sign inSign up

luoxudong/imagecompress

By luoxudong

•Updated about 2 years ago

该镜像为图片压缩服务,底层使用的图片压缩算法为google开源的squoosh

Image
0

334

luoxudong/imagecompress repository overview

Docker部署 你可以使用Docker部署该应用

⁠1.安装Docker环境
⁠2.拉取镜像
docker pull luoxudong/imagecompress:tagname
⁠3.部署启动服务
docker run -p 8866:8866 luoxudong/imagecompress:tagname
⁠4. API调用

接口地址:http://localhost:8866/compress⁠

curl --location 'http://localhost:8867/compress' \
--form 'file=@"/C:/Users/luoxudong/Pictures/1.png"' \
--form 'quality="75"' \
--form 'width="1000"' \
--form 'ct="attachment"' \
--form 'target="jpg"'

参数说明
file: (必传) 文件内容,文件的key值为"file"。
quality: (选填) 图片压缩质量,不传时默认为75。
width: (选填) 设置压缩后输出图片的宽度,高度不设置时按等比例压缩。
height: (选填) 设置压缩后输出图片的高度,宽度不设置时按等比例压缩。
ct: (选填) 设置输出图片的Content-Type,“attachment”为以附件方式输出,其他为以预览图片方式输出。
target: (选填) 压缩后的图片格式,默认跟附件后缀一致,支持的值:"jpg" | "png" | "webp" | "avif" | "jxl。

Tag summary

Content type

Image

Digest

sha256:4a36a8add…

Size

93.5 MB

Last updated

about 2 years ago

docker pull luoxudong/imagecompress