Bug 2237849

Summary: processing x265 un/encoded heic/heif images fails
Product: [Fedora] Fedora Reporter: Alain Touret <alain.touret-ext>
Component: libheifAssignee: Dominik 'Rathann' Mierzejewski <dominik>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 38CC: dominik, gui1ty, multimedia-sig, ngompa13, sergio
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libheif-1.16.2-2.fc40 libheif-1.16.2-2.fc38 libheif-1.16.2-2.fc37 libheif-1.16.2-2.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-10 20:58:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Image Magick mogrify call trace on an heif image none

Description Alain Touret 2023-09-07 10:11:50 UTC
Created attachment 1987512 [details]
Image Magick mogrify call trace on an heif image

Description of problem:

With ImageMagick-7.1.1.15 with libheif support on Fedora 38, processing x265 un/encoded heic/heif images fails

Version-Release number of selected component (if applicable):
ImageMagick-7.1.1.15-1.fc38.x86_64
ImageMagick-heic-7.1.1.15-1.fc38.x86_64
ImageMagick-libs-7.1.1.15-1.fc38.x86_64
ImageMagick-perl-7.1.1.15-1.fc38.x86_64
libde265-1.0.12-1.fc38.x86_64
libheif-1.16.1-1.fc38.x86_64

How reproducible:
Always

Steps to Reproduce:
1. docker run -it registry.fedoraproject.org/fedora:38
2. dnf install ImageMagick ImageMagick-libs ImageMagick-heic wget strace
3. wget https://github.com/strukturag/libheif/tree/master/tests/data/uncompressed_pix_tile_align.heif 
4. strace -o mogrify.log magick mogrify -resize 50%  -format jpg uncompressed_pix_tile_align.heif

please note that the `strace -o mogrify.log`  prefix is optional and is used to generate the call trace of the launched program


Actual results:
Running this command generates this error :
mogrify: Unsupported feature: Unsupported image type (4.3001) `uncompressed_pix_tile_align.heif' @ error/heic.c/IsHEIFSuccess/138.
This error is generated inside the libheif heic.c project file

Expected results:
a jpg image of half dimensions of the original one

Additional info:
ImageMagick-7.1.1.15 includes these delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib gvc heic jbig jng jp2 jpeg jxl lcms lqr ltdl lzma openexr pangocairo png ps raqm raw rsvg tiff webp wmf x xml zip zlib

Any other test image of the libheif project fail similarly. 
Other x265 encoded heic/heif images processing fail also

Adding RPM-fusion repository and installing libheif-freeworld makes possible to process x265 encoded images, but NOT the project test images
1. rpm -ivh  https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm   https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
2. microdnf -y install libheif-freeworld libde265
3. magick mogrify -resize 50%  -format jpg uncompressed_pix_tile_align.heif

Comment 1 Sergio Basto 2023-09-07 10:52:37 UTC
(In reply to Alain Touret from comment #0)
> but NOT the project test images

Hi, 
what do you mean by "but NOT the project test images" ? 


x265 is not allowed on Fedora as they aren't open and free (as freedom)

Comment 2 Dominik 'Rathann' Mierzejewski 2023-09-07 10:56:48 UTC
(In reply to Alain Touret from comment #0)
[...]
> Steps to Reproduce:
> 1. docker run -it registry.fedoraproject.org/fedora:38
> 2. dnf install ImageMagick ImageMagick-libs ImageMagick-heic wget strace
> 3. wget
> https://github.com/strukturag/libheif/tree/master/tests/data/
> uncompressed_pix_tile_align.heif 

This is not a HEIF image, but a link to its GitHub page.

I think you meant:
https://raw.githubusercontent.com/strukturag/libheif/master/tests/data/uncompressed_pix_tile_align.heif

GIMP complains about undefined bit depth when trying to import that file,
but that seems to be because even libheif's own heif-info can't decode it:

$ heif-info uncompressed_comp_tile_align.heif 
MIME type: image/heif
main brand: mif1
compatible brands: mif1, heif

image: 20x10 (id=1), primary
  color profile: no
  alpha channel: no 
  depth channel: no
metadata:
  none
transformations:
  none
region annotations:
  none
properties:
Could not decode image Unsupported feature: Unsupported image type

I guess it's a bug in libheif, then.

Note: I can process other H.265 images just fine:
1. wget https://github.com/dsoprea/heic-exif-samples/raw/master/image1.heic
2. heif-info image1.heic
MIME type: image/heic
main brand: heic
compatible brands: mif1, heic

image: 3992x2992 (id=49), primary
  color profile: prof
  alpha channel: no 
  depth channel: no
metadata:
  Exif: 88 bytes
transformations:
  none
region annotations:
  none
properties:
3. magick mogrify -resize 50%  -format jpg image1.heic

Comment 3 Dominik 'Rathann' Mierzejewski 2023-09-07 10:57:22 UTC
(In reply to Sergio Basto from comment #1)
> (In reply to Alain Touret from comment #0)
> > but NOT the project test images
> 
> Hi, 
> what do you mean by "but NOT the project test images" ? 
> 
> 
> x265 is not allowed on Fedora as they aren't open and free (as freedom)

He did mention installing libheif-freeworld doesn't help and I can reproduce that locally, too.

Comment 4 Alain Touret 2023-09-07 13:06:11 UTC
(In reply to Dominik 'Rathann' Mierzejewski from comment #3)
> (In reply to Sergio Basto from comment #1)
> > (In reply to Alain Touret from comment #0)
> > > but NOT the project test images
> > 
> > Hi, 
> > what do you mean by "but NOT the project test images" ? 
> > 
> > 
> > x265 is not allowed on Fedora as they aren't open and free (as freedom)
> 
> He did mention installing libheif-freeworld doesn't help and I can reproduce
> that locally, too.

Hi,

> > what do you mean by "but NOT the project test images" ? 

I mean the sample images in https://github.com/strukturag/libheif/tree/master/tests/data/

Comment 5 Sergio Basto 2023-09-07 23:13:20 UTC
Hi, new version of libheif was already built in koji , can you test it with it ? 

https://bugzilla.redhat.com/show_bug.cgi?id=2209197#c8

Comment 6 Dominik 'Rathann' Mierzejewski 2023-09-08 12:27:28 UTC
(In reply to Sergio Basto from comment #5)
> Hi, new version of libheif was already built in koji , can you test it with
> it ? 
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=2209197#c8

I'm getting the same
"Could not decode image Unsupported feature: Unsupported image type"
error with heif-info from 1.16.2 (with corresponding -freeworld package installed, too).

However, after digging a bit, I think I found the bug. Fix in progress.

Comment 7 Fedora Update System 2023-09-10 20:56:36 UTC
FEDORA-2023-9f69ed7712 has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2023-9f69ed7712

Comment 8 Fedora Update System 2023-09-10 20:58:35 UTC
FEDORA-2023-9f69ed7712 has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Fedora Update System 2023-09-10 21:06:56 UTC
FEDORA-2023-9b46034298 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-9b46034298

Comment 10 Fedora Update System 2023-09-10 21:06:56 UTC
FEDORA-2023-78dc5f2229 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2023-78dc5f2229

Comment 11 Fedora Update System 2023-09-10 21:06:58 UTC
FEDORA-2023-c84107618a has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-c84107618a

Comment 12 Fedora Update System 2023-09-11 01:36:37 UTC
FEDORA-2023-9b46034298 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-9b46034298`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-9b46034298

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2023-09-11 02:14:52 UTC
FEDORA-2023-c84107618a has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-c84107618a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-c84107618a

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Fedora Update System 2023-09-11 02:28:08 UTC
FEDORA-2023-78dc5f2229 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-78dc5f2229`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-78dc5f2229

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 15 Fedora Update System 2023-09-12 02:32:26 UTC
FEDORA-2023-c84107618a has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 16 Fedora Update System 2023-09-19 02:20:31 UTC
FEDORA-2023-78dc5f2229 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 17 Fedora Update System 2023-09-26 00:17:10 UTC
FEDORA-2023-9b46034298 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 18 Alain Touret 2023-09-26 07:04:42 UTC
I have tested the corrected libheif package distributed with Fedora 38 and confirm that the bug is fixed. 
I want to thank the libheif team for his excellent work.

Comment 19 Dominik 'Rathann' Mierzejewski 2023-09-26 09:26:33 UTC
(In reply to Alain Touret from comment #18)
> I have tested the corrected libheif package distributed with Fedora 38 and
> confirm that the bug is fixed. 
> I want to thank the libheif team for his excellent work.

You are most welcome! Thanks for reporting the issue!