Last update at :2024-05-19,Edit by888u
There is still quite a demand for this project. I saw this program open sourced by Google today, so I installed it and the experience is very good. The original webp2jpg has been thrown away. webp2jpg is so confusing, it will automatically jump to his website after you deploy it yourself. .
No more nonsense.
Basic information
Squoosh is an image compression web application that reduces image size in a variety of formats.
This program image conversion is completed locally, and the converted images will not be uploaded to the server.
Squoosh has an API and a CLI to compress many images at once.
GitHub: https://github.com/GoogleChromeLabs/squoosh
demo: https://img.cheshirex.com/
Supported output formats: AVIF, Browser JPEG, Browser PNG, JPEG XL (beta), MozJPEG, OxiPNG, WebP, WebP v2 (unstable)
Tutorial begins
Tutorial environment: Centos 7.x operating system, Pagoda Linux panel environment (PM2 manager installed).
No screenshots were taken during the installation process of this tutorial. I will try my best to use words to make it clear here.
First create a directory in wwwroot to store the image conversion tool source code. The directory for this article is /www/wwwroot/squoosh.
Enter the created directory
cd /www/wwwroot/squoosh
Package and run the cloned project, executing one line of commands at a time.
git clone https://github.com/GoogleChromeLabs/squoosh.gitnpm install
npm run build
npm run dev
We will see information that the program executed successfully.
But after we turned off SSH, we found that it stopped running.
We need to create a screen session to keep it running.
Installation
yum install screen
Create session and run
screen -S squooshcd /www/wwwroot/squoosh/squoosh
npm run dev
If you need to end the session, just
screen -d -r squoosh
At this time, the program is running on port 5000, which is not convenient to access. We can create a reverse proxy.
For example, I use the img.cheshirex.com domain name to create a new site and reverse proxy http://127.0.0.1:5000.
You can now access Squoosh using your domain name.
Recommended site searches: Foshan high-defense server, overseas virtual host, Ministry of Industry and Information Technology registration query, foreign PHP space, registration information, Hong Kong server rental 99idc, website domain name query, PHP virtual space, Singapore server, South Korea cn2 server
发表评论