Skip to main content

Optimize Images is a plugin for Pelican, a static site generator written in Python.

Optimize Images applies lossless compression on JPEG and PNG images, with no effect on image quality. It uses jpegtran and OptiPNG.

PyPI version number Changelog Supported Python version License Download Count

Installation

The easiest way to install Optimize Images is through the use of pip. This will also install the required Python dependencies automatically.

pip install minchin.pelican.plugins.optimize_images

It is assumed both jpegtran and OptiPNG are installed on system path.

If you are using Pelican 4.5, it should automatically be activated (through my AutoLoader plugin).

If you are using an earlier version of Pelican or autoloading isn’t working, then in your pelicanconf.py file, add Optimize Images to your list of plugins:

PLUGINS = [
    # others...
    "minchin.pelican.plugins.optimize_images",
    # ...
]

Requirements

Optimize Images depends on (and is really only useful with) Pelican. This can be manually installed with pip:

pip install pelican

It is assumed both jpegtran and OptiPNG are installed on system path. On Windows, installers are available at each respective website. On Ubuntu systems, the two can be installed via apt-get:

apt-get install optipng libjpeg-progs

Configuration and Usage

The plugin will activate and optimize images upon finalized signal of pelican.

If add OPTIMIZE_IMAGES_DEV_MODE = True to your pelicanconf.py, this will disable the plugin, which is useful when developing your site locally.

Known Issues

Image manipulation like this can take some time to run. You may consider only adding this plugin to your publishconf.py (rather than your base pelicanconf.py) or add OPTIMIZE_IMAGES_DEV_MODE = True to your pelicanconf.py, which will then only run this image optimization in preparation for site publication.

An issue, as such, is that there is no formal test suite. Testing is currently limited to my in-use observations. I also run a basic check upon uploaded the package to PyPI that it can be downloaded and loaded into Python.

The package is tested in Python 3.10; compatibility with other version of Python is unknown, but there should be nothing particular keeping it from working with other “modern” versions of Python.

Credits

Original plugin from the Pelican-Plugins repo.

License

The plugin code is assumed to be under the AGPLv3 license (this is the license of the Pelican-Plugins repo).

Metadata

Release files for minchin.pelican.plugins.optimize-images 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for minchin.pelican.plugins.optimize-images 1.3.0
File Size Uploaded
minchin_pelican_plugins_optimize_images-1.3.0.tar.gz 18.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for minchin.pelican.plugins.optimize-images 1.3.0
File Interpreter ABI Platform
minchin_pelican_plugins_optimize_images-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.2 kB

Release files / minchin_pelican_plugins_optimize_images-1.3.0.tar.gz

Download URL minchin_pelican_plugins_optimize_images-1.3.0.tar.gz
Size 18.2 kB
Tags Source
SHA-256 checksum
How to use checksums
efbea2a966eeafd3befabbfa94522f9eb67a92b417360a9af1f789e33bc5ca93
BLAKE2b-256 checksum
How to use checksums
6ea82539cc4729ff84866b5189f682841f9e1574edf870f9ed27244a91e41078
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.0

Release files / minchin_pelican_plugins_optimize_images-1.3.0-py3-none-any.whl

Download URL minchin_pelican_plugins_optimize_images-1.3.0-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af2d62831c00b50487d6544a4b0695ee42301a2751a0701d009c5bc5f94e785a
BLAKE2b-256 checksum
How to use checksums
cde8472cbcc1745765ce4321786e73429ea526a5b2463c9368b2c351177c1d0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.0

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page