File: optimize.rst

package info (click to toggle)
willow 1.11.0-0.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,952 kB
  • sloc: xml: 20,346; python: 3,969; makefile: 153; sh: 11
file content (23 lines) | stat: -rw-r--r-- 1,016 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Optimizing images
=================

Aside from the basic optimizations that the Pillow backend provides, Willow supports using dedicated libraries to
optimize images. Out of the box, Willow comes with optimizers for `gifsicle <https://www.lcdf.org/gifsicle/>`_,
`jpegoptim <https://www.kokkonen.net/tjko/projects.html>`_, `optipng <https://optipng.sourceforge.net/>`_,
`pngquant <https://pngquant.org/>`_ and `cwebp <https://developers.google.com/speed/webp/docs/cwebp>`_.

They can be enabled by setting the ``WILLOW_OPTIMIZERS`` environment variable to ``true``. To enable a specific
subset of optimizers, set the ``WILLOW_OPTIMIZERS`` environment variable to a comma-separated list of their
library names. For example, to enable only ``jpegoptim`` and ``optipng``:

.. code-block:: ini

    WILLOW_OPTIMIZERS=jpegoptim,optipng

or if using Django:

.. code-block:: python

    WILLOW_OPTIMIZERS = "jpegoptim,optipng"
    # or as a list of optimizer library names
    WILLOW_OPTIMIZERS = ["jpegoptim", "optipng"]