GithubHelp home page GithubHelp logo

minchinweb / minchin.pelican.plugins.optimize_images Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 35 KB

A Pelican plugin that applies lossless compression on JPEG and PNG images.

License: GNU Affero General Public License v3.0

Python 100.00%
pelican pelican-plugins jpegtran optipng optimize-images

minchin.pelican.plugins.optimize_images's Introduction

Optimize Images

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

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).

minchin.pelican.plugins.optimize_images's People

Contributors

erfaan avatar minchinweb avatar noirbizarre avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

minchin.pelican.plugins.optimize_images's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.