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

[image] Rename "use_transparency" to "transparency" #4595

Merged
merged 1 commit into from
Jan 19, 2025
Merged
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
2 changes: 1 addition & 1 deletion components/animation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Configuration variables:
- ``RGB565``: Lossy RGB color stored. Uses 2 bytes per pixel, 3 with an alpha channel.
- ``RGB``: Full RGB color stored. Uses 3 bytes per pixel, 4 with an alpha channel.

- **use_transparency** (*Optional*): If set the alpha channel of the input image will be taken into account. The possible values are ``opaque`` (default), ``chroma_key`` and ``alpha_channel``. See discussion on transparency in the :ref:`image component <display-image>`.
- **transparency** (*Optional*): If set the alpha channel of the input image will be taken into account. The possible values are ``opaque`` (default), ``chroma_key`` and ``alpha_channel``. See discussion on transparency in the :ref:`image component <display-image>`.
- **loop** (*Optional*): If you want to loop over a subset of your animation (e.g. a fire animation where the fire "starts", then "burns" and "dies") you can specify some frames to loop over.

- **start_frame** (*Optional*, int): The frame to loop back to when ``end_frame`` is reached. Defaults to the first frame in the animation.
Expand Down
8 changes: 4 additions & 4 deletions components/image.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For showing images downloaded at runtime, take a look at the :ref:`Online Image
- file: mdi:alert-outline
id: alert
type: grayscale
use_transparency: alpha_channel
transparency: alpha_channel
resize: 80x80

.. code-block:: yaml
Expand Down Expand Up @@ -58,7 +58,7 @@ Configuration variables:
- ``RGB565``: Lossy RGB color stored. Uses 2 bytes per pixel, 3 with an alpha channel.
- ``RGB``: Full RGB color stored. Uses 3 bytes per pixel, 4 with an alpha channel.

- **use_transparency** (*Optional*): If set the alpha channel of the input image will be taken into account. The possible values are ``opaque`` (default), ``chroma_key`` and ``alpha_channel``. See discussion on transparency below.
- **transparency** (*Optional*): If set the alpha channel of the input image will be taken into account. The possible values are ``opaque`` (default), ``chroma_key`` and ``alpha_channel``. See discussion on transparency below.

- **dither** (*Optional*): Specifies which dither method used to process the image, only used in GRAYSCALE and BINARY type image. Defaults to ``NONE``. You can read more about it `here <https://pillow.readthedocs.io/en/stable/reference/Image.html?highlight=Dither#PIL.Image.Image.convert>`__ and `here <https://en.wikipedia.org/wiki/Dither>`__.

Expand Down Expand Up @@ -165,8 +165,8 @@ as the additional parameters.
Transparency options
--------------------

By default transparency is not used. If ``use_transparency: chroma_key`` is set then a specific colour (0, 1, 0) will be used to replace any transparent or partially transparent portions of the image. This will not be drawn when rendering the image, allowing the background to be visible.
By default transparency is not used. If ``transparency: chroma_key`` is set then a specific colour (0, 1, 0) will be used to replace any transparent or partially transparent portions of the image. This will not be drawn when rendering the image, allowing the background to be visible.

If ``use_transparency: alpha_channel`` is set, then each pixel of the image will be assigned an additional byte with a transparency value. This is useful mainly when using :doc:`LVGL </components/lvgl/index>` as the ``alpha_channel`` transparency will enable smooth blending of transparent images with the background.
If ``transparency: alpha_channel`` is set, then each pixel of the image will be assigned an additional byte with a transparency value. This is useful mainly when using :doc:`LVGL </components/lvgl/index>` as the ``alpha_channel`` transparency will enable smooth blending of transparent images with the background.
When using the display lambda image drawing functions these will draw or not draw the pixel, no blending with the background will be done.
The ``BINARY`` format only permits ``chroma_key`` transparency, which effectively turns the image into an alpha mask with one bit per pixel. GRAYSCALE images with transparency store the alpha channel only, and remain 1 byte per pixel.
16 changes: 5 additions & 11 deletions components/online_image.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,14 @@ Configuration variables
and preserve the aspect ratio.
- **placeholder** (**Optional**, :ref:`config-id`): ID of an :doc:`Image </components/image>` to display while the downloaded image is not yet ready.
This placeholder image will **not** be resized; regardless of the ``resize`` option value for the ``online_image``.
- **type** (*Optional*): Specifies how to encode image internally. Defaults to ``BINARY``.
- **type** (*Required*): Specifies how to encode image internally.

- ``BINARY``: Two colors, suitable for 1 color displays or 2 color image in color displays. Uses 1 bit
per pixel, 8 pixels per byte.
- ``TRANSPARENT_BINARY``: One color, any pixel that is fully transparent will not be drawn, and any other pixel
will be the on color. Uses 1 bit per pixel, 8 pixels per byte.
per pixel, 8 pixels per byte. Only ``chroma_key`` transparency is available.
- ``GRAYSCALE``: Full scale grey. Uses 8 bits per pixel, 1 pixel per byte.
- ``RGB565``: Lossy RGB color stored. Uses 2 bytes per pixel.
- ``RGB24``: Full RGB color stored. Uses 3 bytes per pixel.
- ``RGBA``: Full RGB color stored. Uses 4 bytes per pixel. Any pixel with an alpha value < 127 will not be drawn.
- **use_transparency** (*Optional*, boolean): If set the alpha channel of the input image will be taken into account,
and pixels with alpha < 127 will not be drawn. For image types without explicit alpha channel,
the color (0, 0, 1) (very dark blue) will be mapped to black, to be able to store transparency information
within the image. Explicitly transparent types (``TRANSPARENT_BINARY`` and ``RGBA``) default to ``true`` and cannot be set to ``false``; other types default to ``false``.
- ``RGB565``: Lossy RGB color stored. Uses 2 bytes per pixel, 3 with an alpha channel
- ``RGB``: Full RGB color stored. Uses 3 bytes per pixel, 4 with an alpha channel.
- **transparency** (*Optional*): If set the alpha channel of the input image will be taken into account. The possible values are ``opaque`` (default), ``chroma_key`` and ``alpha_channel``. See the discussion on transparency in the :ref:`image component <display-image>`.
- **update_interval** (*Optional*, int): Redownload the image when the specified time has elapsed. Defaults to ``never`` (i.e. the update component action needs to be called manually).

Automations
Expand Down
Loading