This pelican plugin uses ImageMagick, PNGQuant & Gifsicle to optimize images for web. Using these tools give a fast and efficient result.
ImageMagick, Gifsicle & pngquant are required.
On Ubuntu:
sudo apt-get install gifsicle imagemagick pngquantOn Fedora:
sudo yum install -y gifsicle ImageMagick pngquantSee the pelican documentation.
All the GIF, PNG & JPEG images of your blog will be optimized during the build.
Adding IMAGE_OPTIMIZATION_ONCE_AND_FOR_ALL = True to you pelicanconf.py will optimize the images in the content folder directly. The files will be renamed _optimized, but once in the output folder, they will be renamed without the _optimized.
The markdown files need to use the name without _optimized.
Example:
- I write the article
testwith an imagecontent/img/test.pnglinked in the template and saved in my content folder. - On pelican generation, the file is optimized in my content folder and renamed
test_optimized.png. In my output folder, the file istest.png, so my markdown link still works. - On the next pelican generation, the file won't be optimized, reducing the time for the generation.