A minimal example of a Express server that implements ImageMin and the Jpeg-Recompress ImageMin Pluguin;
-
Clone the repository or download the zip file;
-
Open a terminal in the directory where you have cloned this repo and run
npm run build
in order to install all the packages and dependencies. Then runnpm run dev
to initialize the server; -
Open your browser and go to localhost:3000
-
Select a jpg image to compress and press the UPLOAD button.
-
Enjoy the pleasure of having 3 beautiful lines that displays the sizes of the uncompressed and the compressed files in your own screen.
-
Bon Apetit.
-
Same as before but go to localhost:300/ajax
-
Select a file;
-
Click on ToCanvas button. It will draw the jpeg image to the canvas.
-
Click on ToData button. It will turn the canvas into a blob.
-
click on toServer button. It will send de blob to the server and then compress it;
-
Check the therminal, it will display some logs with the old and the new sizes.