Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1 to 2 #1541

Merged
merged 4 commits into from
Dec 12, 2023
Merged

1 to 2 #1541

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions Resources/doc/filters/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,81 @@ Interlace Options
``plane``, and ``partition``.


.. _filter-resample:

Resample
--------

The built-in ``resample`` filter provides a resampling transformation by allows you to
change the resolution of an image. This filter exposes a number of `resample options`_ which
may be used to configure its behavior.

.. tip::

Resampling changes the image resolution (also known as "pixel density") of an image
and is useful when you need to present different versions of an image dependent on
the user's screen density. For example, you may need to provide a "normal" and a
"retina" variant.

The use of "resolution" is not to be confused with "dimensions". This filter does not
affect the dimentions of an image, only the pixel density.


Example configuration:

.. code-block:: yaml

# app/config/config.yml

liip_imagine:
filter_sets:

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

# use and setup the "resample" filter
resample:

# set the unit to use for pixel density
unit: ppi

# set the horizontal pixel density
x: 72

# set the vertical pixel density
y: 72

# set the resampling filter
filter: lanczos

# set the temporary path to use for resampling work
tmp_dir: /my/custom/temporary/directory/path


Resample Options
~~~~~~~~~~~~~~~~

**unit:** ``string``
Sets the unit to use for pixel density, either "pixels per inch" or "pixels per centimeter".
Valid values: ``ppi`` and ``ppc``.

**x:** ``int|float``
Sets the horizontal (x) pixel density to resample the image to.

**y:** ``int|float``
Sets the vertical (y) pixel density to resample the image to.

**filter:** ``string``
Sets the optional filter to use during the resampling operation. It must be a string resolvable
as a constant from `Imagine\Image\ImageInterface`_ (you may omit the ``FILTER_`` prefix)
or a valid fully qualified constant. By default it is set to ``FILTER_UNDEFINED``.

**tmp_dir:** ``string``
Sets the optional temporary work directory. This filter requires a temporary location to save
out and read back in the image binary, as these operations are requires to resample an image.
By default, it is set to the value of the `sys_get_temp_dir()`_ function.

.. _filter-strip:

Strip
Expand Down
4 changes: 4 additions & 0 deletions Resources/doc/filters/sizing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ Thumbnail Options
Sets the generated thumbnail size as an integer array containing the dimensions
as width and height values.

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

.. _filter-fixed:

Fixed size
Expand Down
6 changes: 6 additions & 0 deletions Resources/doc/post-processors/png-opti.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Options
When multi-images are encountered (for example, an animated image), this causes one of the images to be kept and drops
the other ones. Depending on the input format, this may be either the first or the most relevant (e.g. the largest) image.

**strip_all:** ``bool`` (deprecated)
Removes all comments, EXIF markers, and other image metadata.

**level:** ``int``
Sets the image optimization factor, from 0 to 7.

**strip:** ``bool|string``
When set to ``true``, all extra image headers, such as its comments, EXIF markers, and other metadata, will be removed.
Equivalently, the string value ``all`` also removes all extra metadata.
Expand Down
2 changes: 1 addition & 1 deletion Resources/doc/post-processors/png-quant.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ Parameters
----------

**liip_imagine.pngquant.binary:** ``string``
Sets the location of the ``pnquant`` executable. Default is ``/usr/bin/pngquant``.
Sets the location of the ``pngquant`` executable. Default is ``/usr/bin/pngquant``.
Loading