You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
open_heif/read_heif with convert_hdr_to_8bit=False will open 10/12 bit images in 16 bit mode automatically(and it faster now and takes less RAM during decoding).
original_bit_depth in info dictionary was renamed to bit_depth, standalone bit_depth was removed.
heif_file=pillow_heif.open_heif("images/rgb12.heif")
print("image bit depth:" , heif_file.bit_depth)
->
heif_file=pillow_heif.open_heif("images/rgb12.heif")
print("image bit depth:" , heif_file.info["bit_depth"])
it is standardized now and shows the bit-depth of image in file(not the decoded one, so it may differs from bit depth of mode), for both Pillow plugin and stand-alone usage.
thumbnails was simplified, temporary remove ability for getting their data and now it is just a list with thumbnails boxes.
For both the Pillow plugin and standalone use, this list will be in the info dictionary. It simply allows you to delete thumbnails or add new ones without being able to retrieve their data. (I can’t make it universal for both modes, when there is an idea how to do it without loss of performance, I’ll do it)
encode function added.
defencode(mode: str, size: tuple, data, fp, **kwargs) ->None:
"""Encodes data in a ``fp``. :param mode: `BGR(A);16`, `RGB(A);16`, LA;16`, `L;16`, `I;16L`, `BGR(A)`, `RGB(A)`, `LA`, `L` :param size: tuple with ``width`` and ``height`` of an image. :param data: bytes object with raw image data. :param fp: A filename (string), pathlib.Path object or an object with ``write`` method."""
Useful in situations where you want just save one image to a new file.
Old code that do the same(it still will be worked):
The main and most important change to me, is that from this version info dictionaries are fully equal between Pillow version and open_heif version.
That's will make use and support of this project very simple.
Here will be information about changes for
0.10
version.Release date: NEXT WEEK (21.02-23.02)
Main features of 0.10.0 version:
C
module, most parts of project were reworked.LA
&LA;16
modes.1.12.0
pillow_heif.libheif_info() was simplified to such dictionary:
Changes when using as a Pillow plugin:
info
dictionarymetadata.content_type
is nowstr
instead ofbytes
.Changes when using as a standalone:
convert_to
method removed, instead optionalbgr_mode
parameter toopen_heif
&read_heif
added.open_heif/read_heif with
convert_hdr_to_8bit=False
will open 10/12 bit images in 16 bit mode automatically(and it faster now and takes less RAM during decoding).BGR modes(OpenCV) - old code:
->
original_bit_depth
in info dictionary was renamed tobit_depth
, standalonebit_depth
was removed.->
it is standardized now and shows the bit-depth of image in file(not the decoded one, so it may differs from bit depth of mode), for both Pillow plugin and stand-alone usage.
thumbnails
was simplified, temporary remove ability for getting their data and now it is just a list with thumbnails boxes.For both the Pillow plugin and standalone use, this list will be in the
info
dictionary. It simply allows you to delete thumbnails or add new ones without being able to retrieve their data. (I can’t make it universal for both modes, when there is an idea how to do it without loss of performance, I’ll do it)encode
function added.Useful in situations where you want just save one image to a new file.
Old code that do the same(it still will be worked):
New alternative:
Both methods are faster now, as data passes directly to LibHeif(
encode
will be faster as it does not createHeifFile
class).The text was updated successfully, but these errors were encountered: