Supported image extension (svg|png|jpg|jpeg|gif).
Here is my gulpfile to quickly compress images with or without loss of quality.
Feel free to suggest improvements by creating issues or fork it !
This project includes lot of nodes module. Please read package.json and package-lock.json to check their own licenses.
-
Clone the repository.
-
Install dependencies of npm using
npm i. -
Moove your images in
inputfolder.
⚠ Be careful, do not put the files in the "output" folder. It will be cleared at runtime ⚠ -
Run
gulpwith one command discribe bellow. -
You're done your images will be in the
outputfolder.
I prefer to use package locally so I use npx to execute gulp. If you prefer to call gulp directly, install it globally : npm i -g gulp
By default, gulp compresses your images without loss of quality.
If you want more compression, you can ask gulp to use a compression alogrithm with minimal loss of quality.
If you want more compression again, you can ask gulp to run the alogrithms several times with more loss of quality.
Clear output folder.
Clear input and output folder.