Skip to content

Commit

Permalink
encode: subsampling parameter higher priority over chroma (#213)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Piskun <[email protected]>
  • Loading branch information
bigcat88 authored Feb 27, 2024
1 parent d0c2acc commit 7080ad6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
All notable changes to this project will be documented in this file.

## [0.16.0 - 2024-02-2x]

### Changed

- `subsampling` parameter for encoding has higher priority then `chroma`.

## [0.15.0 - 2024-02-03]

### Added
Expand Down
2 changes: 1 addition & 1 deletion pillow_heif/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Version of pillow_heif/pi_heif."""

__version__ = "0.15.0"
__version__ = "0.16.0.dev0"
6 changes: 4 additions & 2 deletions pillow_heif/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,11 @@ def __init__(self, compression_format: HeifCompressionFormat, **kwargs):
options.PREFERRED_ENCODER.get("HEIF" if compression_format == HeifCompressionFormat.HEVC else "AVIF", ""),
)
enc_params = kwargs.get("enc_params", {})
chroma = kwargs.get("chroma", None)
if chroma is None and "subsampling" in kwargs:
chroma = None
if "subsampling" in kwargs:
chroma = SUBSAMPLING_CHROMA_MAP.get(kwargs["subsampling"], None)
if chroma is None:
chroma = kwargs.get("chroma", None)
if chroma:
enc_params["chroma"] = chroma
for key, value in enc_params.items():
Expand Down

0 comments on commit 7080ad6

Please sign in to comment.