How to Enable Previews for Sony *.heif Files in Nextcloud with Imaginary? (Apple *.heic is working)

Hi everyone,

Does anyone know how to get photo previews for *.heif files created with a Sony camera? I’m using a Sony a6700, and here’s an example image for reference: Download Example Image. (available for 30d)

My Setup: Old (community-maintained) nextcloud docker container combined with the imaginary aio container (I am currently using the beta version to address libheif/iOS 8 HEIC file issues).

Every “normal” format like JPG, PNG, and Apple HEIC works fine. However, for *.heif files, the preview generation fails with the following log entry:

Info: Imaginary preview generation failed:
Client error: POST http://imaginary:9000/pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A1080%2C%22height%22%3A1920%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%2C%22quality%22%3A%2270%22%7D%7D%5D&key= resulted in a 406 Not Acceptable response: {“message”:“Unsupported media type”,“status”:406}

How can I enable preview generation for such HEIF files?

Thanks in advance for any guidance!

Kind regards,
Thorsten

I can confirm, I have not been able to get previews created with Imaginary either.

As a workaround, you should activtivate the

'OC\\Preview\\HEIC'

preview provider. That one creates previews of your sample file using image magick.

h.t.h.


Much and good luck,
ernolf

Hi,
thanks for confirming and the workaround. However, with imagemagick, I then get the current iOS 18 heic fotos issue :confused: Do you if there is a config option to just use imagemagick für *.heif files and imaginary for everything else?

Thanks!

Could you explain more in detail, eventualy with an example file, what exactly is that issue?


ernolf

Hi, apple changed something in there heic format with the current iOS 18 version. There are multiple bug reports open for it, like for example ImagickException Failed to read the file · Issue #47289 · nextcloud/server · GitHub The new heic files are only support by libheif 1.18.

I think the workaround would be to create a docker image where imagemagick is build from source like it is explained here Nextcloud: Fehlerhafte Bildanzeige von HEIC-Bildern beheben (iOS/iPadOS 18) » DecaTec (unfortunately in german).

But, I am a bit to lazy to rebuild this container for each image update and thus just switched to the imaginary beta container which already uses the libheif 1.19 (and should be more secure). However, this solution does not support the sony heif files :frowning:

1 Like

So it sounds like this should be reported to GitHub - strukturag/libheif: libheif is an HEIF and AVIF file format decoder and encoder., no?

Hi,
I’m actually struggling to figure out which component is causing the issue and where to open a bug/issue report. I thought both imaginary and imagemagick use libheif, and the sony heif files are working with imagemagick.

Did you already try it with both, OC\\Preview\\Imaginary and OC\\Preview\\HEIC enabled? Normaly it will create the preview with the provider that does work.
This is how I understand the code: If Imaginary is enabled, it will try it with Imaginary first and only if Imaginary does not work, it will try the Provider relying on ImageMagick.

Or do you only get an error message and no preview image?


ernolf

Hi, thanks a lot! Actually, I hadn’t tried this. With both enabled, it works for both file types!

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.