-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
added HEIF writer and replaced HEIF reader with a more complete HEIF implementation #1099
Conversation
…on libheif instead
Thanks for the PR 👍 Happy to see we get write support. I was wonder if it would be possible to do also add something for when we only want to ping (get basic image information) the image. Now the whole file is loaded into memory and I was wondering if we could load only part of the image when we want to ping it. |
Oh, that's what the 'ping' flag is for. I was wondering about that already
but could not find out the purpose of that flag.
I am a complete beginner to the ImageMagick code, so I do not know yet:
- whether I am doing things right for "lists of images"
- how to handle alpha channels
- what I should do when the HEIF contains several images (libheif supports
that)
- the iPhone also saves "depth images" into the HEIF as an auxiliary image.
How could I pass them to ImageMagick?
- could I pass more options to the HEIF encoder, like whether it should
generate thumbnails, or whether to switch to lossless mode?
Any pointers to information would be appreciated. Especially alpha channels
would be nice, I think.
Dirk
2018-04-17 17:24 GMT+02:00 Dirk Lemstra <notifications@github.com>:
… Thanks for the PR 👍 Happy to see we get write support. I was wonder if
it would be possible to do also add something for when we only want to ping
(get basic image information) the image. Now the whole file is loaded into
memory and I was wondering if we could load only part of the image when we
want to ping it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1099 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA7I8E9CSeL0Go__pbJ-KwREnDFSC4S2ks5tpgkfgaJpZM4TYfY1>
.
|
Here is support for the 'ping' flag. Hope I did it right. |
Thanks for this PR. This is a great feature supporting HEIF write. |
When will the encoder be released? I think it will be wise to wait till that is available before we merge this. I would prefer it if our users would not need to compile the latest git checkout of libheif to get heif support.
LGTM
You can use
You can take a look at an other decoder that also reads multiple frames and look how
What are depth images and how could we use them?
You will need to create options that start with Prob best to put these extra changes in a separate PR after we merge this one. |
coders/heic.c
Outdated
goto error_cleanup; | ||
} | ||
|
||
|
||
if (image->quality != UndefinedCompressionQuality) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use image_info->quality instead.
Provides optional HEIF support. Note the upstream PR here, which may change things in the future in terms of how this option needs handling: ImageMagick/ImageMagick#1099 Fixes #26444. Closes #26959. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
The libheif package with encoder (v1.1.0) is now in debian testing: https://tracker.debian.org/pkg/libheif |
@farindk Thats great news!!! 🙌 👍 Could you resolve the conflicts in this branch so I can merge this Friday? We will run autoconf ourselves so maybe you could exclude some of your changes. |
@farindk It looks like we need to use x265 to get encoding support? That won't be an option for us since that is licensed under the GPL v2 license. We could still use the libheif library if that means we would get better support for reading files. Can you remove the writer for now? EDIT: I can also merge as is and remove the writer myself. Whats your preference? |
I was not aware that the ImageMagick license does not allow any GPL v2 libraries, as the ImageMagick license page says that it is compatible to GPL v3. It is because of v2/v3 or because of linking against GPL in general? How about this solution: I could change the encoding code in libheif in such a way that it does not link to libx265 at all, but uses the separate "x265" program for encoding, passing the data through a pipe. That way, libheif would be LGPL, if I am correct. EDIT: isn't libfftw also GPL? |
We try to avoid linking against GPL libraries. If we also want to get this building under Windows that would mean we would also need to build the x265 library. But I don't want to invest any time in getting that building on Windows due to the license that is being used. The While writing the message I just got another idea. I could disable writing with the |
Disabling it only for Windows sounds like a good solution to me. Then we can easily enable it later when the dependency is removed. libheif does not require linking to x265. One can register any number of encoding plugins even during runtime. x265 is only one option that is provided by default. But one can also add encoders for AV1, h264, or JPEG. If libx265 is not detected during configuration, that plugin is switched off. In that sense libheif itself is LGPL, but when used together with x265, the combination is GPL. |
I'm using
with heic support. When I converted TIFF files with AdobeRGB profile to HEIC files, the color will be changed. Seems the color profile is not properly copied to the new HEIC files. Also, the input file has Colorspace RGB while the output HEIC one is YCbCr. Is it possible to keep as it? How do I specify the compression rate and using 12bit color depth? Thanks. |
Support for color profiles was just added to libheif (strukturag/libheif#58), but it still needs to be integrated to ImageMagick. RGB colorspace and HDR is on my to-do list. See also strukturag/libheif#62. |
Thanks, @farindk ! I also ran into lossless mode issue. FYI, I found |
Added code for writing HEIF files based on libheif.
https://github.com/strukturag/libheif
There is a Debian package for libheif, but you will need the latest git version for the encoder (will be released soon).
I also replaced the HEIF reader with the implementation from libheif as the old implementation was limited to only reading HEIF files generated by iPhones. The new implementation is a full implementation of the HEIF standard (still image part) including all image compositing operations.
Alpha channel support is in libheif, but not yet implemented here, since I could not figure out yet how to implement this in ImageMagick.