前言
图片压缩的在线网站有过不少,我常用的有
doc small:https://docsmall.com/image-compress
I❤IMG:https://www.iloveimg.com/zh-cn
TinyPNG:https://tinify.cn/
其中最后一个,我经常使用,而且效果也非常不错,但是这次,遇到了一些比较隐私的图片需要压缩,所以担心这些在线网站会不会收集信息,虽然说"互联网上无隐私",但多少还是需要注意一下隐私的,所以思来想去,还是决定自己搭建一个,或者找一个开源项目自己使用。
于是就找到了谷歌的,项目开源地址:https://github.com/GoogleChromeLabs/squoosh
README
Squoosh!
Squoosh is an image compression web app that reduces image sizes through numerous formats.
Privacy
Squoosh does not send your image to a server. All image compression processes locally.
However, Squoosh utilizes Google Analytics to collect the following:
- Basic visitor data.
- The before and after image size value.
- If Squoosh PWA, the type of Squoosh installation.
- If Squoosh PWA, the installation time and date.
Developing
To develop for Squoosh:
- Clone the repository
- To install node packages
run:npm install
- Then build the app by running
npm run build
- After building, start the development server by running
npm run dev
Contributing
Squoosh is an open-source project that appreciates all community involvement. To contribute to the project, follow the contribute guide.
Docker部署
这个项目既可以本地运行修改,也可以发布docker使用,网上搜Squoosh Docker部署,有很多教程,我拿我使用的来展示:
docker run -d --name squoosh -p 85:80 hausen1012/squoosh:latest
即拿服务器上的85端口,映射Docker的80端口,等部署好后,直接域名+端口/IP+端口访问即可。
例如http://localhost:85,我做了反代,具体的反代可以参考我之前的文章:Docker利用宝塔面板进行反代,并部署SSL证书
我搭建的网站为:https://img.xieshuoshuo.top
这样,我就可以在自己网站上压缩自己的图片了,并且不用太担心隐私图片被泄露了。
Comments NOTHING