<commit_before>

Size Filters
============


.. _filter-thumbnail:

Thumbnails
----------

The built-in ``thumbnail`` filter performs thumbnail transformations
(which includes scaling and potentially cropping operations). This
filter exposed a number of `thumbnail options`_ which may be used
to configure its behavior.

Example configuration:

.. code-block:: yaml

    # app/config/config.yml

    liip_imagine:
        filter_sets:

            # name our filter set "my_thumb_filter"
            my_thumb_filter:
                filters:

                    # use and setup the "thumbnail" filter
                    thumbnail:

                        # set the thumbnail size to "32x32" pixels
                        size: [32, 32]

                        # crop the input image, if required
                        mode: outbound

.. seealso::

    More examples are available in the
    :ref:`Basic Usage: Create Thumbnails <usage-create-thumbnails>` chapter.


Thumbnail Options
~~~~~~~~~~~~~~~~~

:strong:`mode:` ``string``
    Sets the desired resize method: ``'outbound'`` crops the image as required, while
    ``'inset'`` performs a non-cropping relative resize.

:strong:`size:` ``int[]``
    Sets the generated thumbnail size as an integer array containing the dimensions
    as width and height values.

:strong:`allow_upscale:` ``bool``
    Toggles allowing image up-scaling when the image is smaller than the desired
    thumbnail size.


.. _filter-crop:

Cropping Images
---------------

The built-in ``crop`` filter performs sizing transformations (which
includes cropping operations). This filter exposed a number of
`crop options`_ which may be used to configure its behavior.

Example configuration:

.. code-block:: yaml

    # app/config/config.yml

    liip_imagine:
        filter_sets:

            # name our filter set "my_crop_filter"
            my_crop_filter:
                filters:

                    # use and setup the "crop" filter
                    crop:

                        # set the size of the cropping area
                        size: [ 300, 600 ]

                        # set the starting coordinates of the crop
                        start: [ 040, 160 ]
<commit_msg>add docs for fixed size filter<commit_after>

Size Filters
============


.. _filter-thumbnail:

Thumbnails
----------

The built-in ``thumbnail`` filter performs thumbnail transformations
(which includes scaling and potentially cropping operations). This
filter exposed a number of `thumbnail options`_ which may be used
to configure its behavior.

Example configuration:

.. code-block:: yaml

    # app/config/config.yml

    liip_imagine:
        filter_sets:

            # name our filter set "my_thumb_filter"
            my_thumb_filter:
                filters:

                    # use and setup the "thumbnail" filter
                    thumbnail:

                        # set the thumbnail size to "32x32" pixels
                        size: [32, 32]

                        # crop the input image, if required
                        mode: outbound

.. seealso::

    More examples are available in the
    :ref:`Basic Usage: Create Thumbnails <usage-create-thumbnails>` chapter.


Thumbnail Options
~~~~~~~~~~~~~~~~~

:strong:`mode:` ``string``
    Sets the desired resize method: ``'outbound'`` crops the image as required, while
    ``'inset'`` performs a non-cropping relative resize.

:strong:`size:` ``int[]``
    Sets the generated thumbnail size as an integer array containing the dimensions
    as width and height values.

:strong:`allow_upscale:` ``bool``
    Toggles allowing image up-scaling when the image is smaller than the desired
    thumbnail size.


.. _filter-fixed:

Fixed size
----------

The built-in ``fixed`` filter performs thumbnail transformations (which includes scaling
and potentially cropping operations). This filter exposed a number of `fixed options`_
which may be used to configure its behavior. Unlike the ``thumbnail`` filter, the
``fixed`` filter supports upscale and you always get a fixed-size image.

Example configuration:

.. code-block:: yaml

    # app/config/config.yml

    liip_imagine:
        filter_sets:

            # name our filter set "my_fixed_filter"
            my_fixed_filter:
                filters:

                    # use and setup the "fixed" filter
                    fixed:

                        # set the fixed size to "120x90" pixels
                        width: 120
                        height: 90


Fixed Options
~~~~~~~~~~~~~

:strong:`width:` ``int``
    Sets the "desired width" which initiates a proportional scale operation that up- or
    down-scales until the image width matches this value.

:strong:`height:` ``int``
    Sets the "desired height" which initiates a proportional scale operation that up- or
    down-scales until the image height matches this value.


.. _filter-crop:

Cropping Images
---------------

The built-in ``crop`` filter performs sizing transformations (which
includes cropping operations). This filter exposed a number of
`crop options`_ which may be used to configure its behavior.

Example configuration:

.. code-block:: yaml

    # app/config/config.yml

    liip_imagine:
        filter_sets:

            # name our filter set "my_crop_filter"
            my_crop_filter:
                filters:

                    # use and setup the "crop" filter
                    crop:

                        # set the size of the cropping area
                        size: [ 300, 600 ]

                        # set the starting coordinates of the crop
                        start: [ 040, 160 ]

{'fraction_non_alphanumeric': 0.09251101321585903, 'fraction_numerical': 0.00881057268722467, 'mean_word_length': 2.0483351235230933, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7226255', 'n_tokens_mistral': 1536, 'n_tokens_neox': 1392, 'n_words': 564}