Add support for the HEIF image format #9115
-
DescriptionHey, We manually compiled a recent version of imagemagick with libheif on the server to get support for this image format and after adding But Craft won't generate a thumbnail because it probably does not know that this is an image format (there is e.g. also no height/width information). Are there any plans on adding HEIF support to Craft? Most distributions currently don't ship a recent enough version of Imagemagick (so you have compile it yourself), but this will hopefully change in the future :D Best, |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 3 replies
-
Yup, we're running into this as well. Can't really launch without this support due to the nature of our project (hundreds of images uploaded by a community each day — many of which likely coming from iphones). |
Beta Was this translation helpful? Give feedback.
-
I did look into this and the whole effort stopped in the Imagick PHP extension not being able to determine the colorspace of the HEIF image. Interestingly, ImageMagick via CLI was able to determine that. Curios, @fleaz, what's the output you get if you do |
Beta Was this translation helpful? Give feedback.
-
Also tracking this for Servd. @andris-sevcenko Using these two images: https://filesamples.com/samples/image/heif/sample1.heif On PHP 8. The output is On CLI:
So it looks like Image Magick CLI is working ok for identification but has some memory issues when working with moderately large (2MB in this case) heif files - it allocated ~500MB RAM before it was killed. |
Beta Was this translation helpful? Give feedback.
-
@mattgrayisok Thanks for the additional info! Without knowing the colorspace, any image manipulation and preserving original colors is pretty much DOA, so currently no easy way on how Craft can implement this. One way of proceeding about this, in general, is to refactor how images are manipulated in general by Craft to allow third parties to provide image drivers, in which case it would become possible for a plugin to provide an interface with the |
Beta Was this translation helpful? Give feedback.
-
Hey @andris-sevcenko Just wanted to confirm that I get the same results as Matt on my machine (PHP 7.4, Imagick 7.0.11). Coincidentally we even used the same example images to test this :D I also see huge memory allocation on the second image (~650-700MB) but after a while it return with |
Beta Was this translation helpful? Give feedback.
-
Circled back on this today, and noticed the Imagine lib got updated recently to support HEIC. So I’ve pulled that in for the next Craft 3 and 4 releases. (d7ee2e2) |
Beta Was this translation helpful? Give feedback.
-
Awesome. Thanks for still thinking about this \o/ |
Beta Was this translation helpful? Give feedback.
-
@brandonkelly Is it possible to disable this in the config? We're finding clients are uploading HEIF images but they aren't supported in Chrome or our version of imagemagik. |
Beta Was this translation helpful? Give feedback.
Circled back on this today, and noticed the Imagine lib got updated recently to support HEIC. So I’ve pulled that in for the next Craft 3 and 4 releases. (d7ee2e2)