HEIC-HEIF encoder saves corrupted files

Reported bugs that have been closed and/or resolved

Moderators: helmut, XnTriq, xnview, Dreamer

Post Reply
view3r
Posts: 4
Joined: Mon Jan 31, 2022 9:16 am

HEIC-HEIF encoder saves corrupted files

Post by view3r »

Hello there,

The JPEG to HEIC/HEIF encoding doesn't seem to work.

Xnview MP 0.99.7 64bits (Jan 13 2022)
Windows 10 Pro x64 21H2 19044.1503

I tried to convert a large folder of couple thousands of jpeg files. XnView doesn't report any errors during conversion process, it saves all the heic files during the conversion, but the output files are corrupted or wrong type, since no program can read them.

XnView itself can't read the output files, neither can ImageGlass. If I upload the output files to google drive, it can't show the pictures.

Despite most of the files were corrupted, very few (literally one in a thousand) were successfully converted. XnView, ImageGlass and Google all read these few files successfully.

This is a screenshot from XnView MP Thumbnails view, there is one HEIC picture that can be read:

Image

However, as can be seen from the screenshot above, most other pictures can't be viewer in XnView.
ImageGlass gives also error message.

Image
Image

I have attached some sample files of the converted files in the attached ZIP file.
image1477.heic is an example of a working file (indeed one of very few out of thousands I tried)
image1478.heic is a typical corrupted file

These were the HEIC conversion settings:

Image
Image

Thanks for your time and effort with this great program. Let me know if I can help somehow with troubleshooting this bug and get the HEIC conversion working.
Attachments
image1477.zip
(192.9 KiB) Downloaded 63 times
User avatar
xnview
Author of XnView
Posts: 46235
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: HEIC-HEIF encoder saves corrupted files

Post by xnview »

Could you send me the original image1477 & image1478?
Pierre.
view3r
Posts: 4
Joined: Mon Jan 31, 2022 9:16 am

Re: HEIC-HEIF encoder saves corrupted files

Post by view3r »

xnview wrote: Mon Feb 14, 2022 8:27 am Could you send me the original image1477 & image1478?
Sure, the original JPEG images are downloadable here: https://e1.pcloud.link/publink/show?cod ... FwO0jF1arV
User avatar
winnylinny
Posts: 167
Joined: Fri Apr 17, 2020 5:35 pm

Re: HEIC-HEIF encoder saves corrupted files

Post by winnylinny »

Seems to have something to do with the metadata and/or color profile.

The first image (1477.jpg) has extra metadata and a particular color profile (IEC61966-2.1), and it seems to always work when converting it to HEIC.

The second image (1478.jpg) has no metadata and uses the standard sRGB color profile, and it always results in a corrupted HEIC when converting.

When trying to load 1477.heic into my iPhone, it accepts it.

When trying to load 1478.heic into my iPhone, it rejects it with the error message:
"The operation couldn't be completed."
"(PHPhotosErrorDomain error -1.)"


See attached screenshot.
phphotoserror-domain-heic-import.png

UPDATE: I can confirm that when using GIMP (both under Linux and Windows) to convert the 1478.jpg to HEIC, it works as expected, and my iPhone can properly import/read the HEIC image.
User avatar
xnview
Author of XnView
Posts: 46235
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: HEIC-HEIF encoder saves corrupted files

Post by xnview »

:bugconfirmed: Thanks to your detailed description I can reproduce the problem.

Seems to be with libHEIF 1.8, with 1.12 no more problem. You can try it by downloading it
Pierre.
User avatar
winnylinny
Posts: 167
Joined: Fri Apr 17, 2020 5:35 pm

Re: HEIC-HEIF encoder saves corrupted files

Post by winnylinny »

xnview wrote: Thu Feb 17, 2022 4:39 pmSeems to be with libHEIF 1.8, with 1.12 no more problem. You can try it by downloading it
I tried with that heif.dll (from your link).

However, when saving to HEIC format, it now results in an empty file (0B in size).

I renamed the original heif.dll to heif.dll.original, and placed inside the plugins folder the new heif.dll.

Was I supposed to try something different?
User avatar
xnview
Author of XnView
Posts: 46235
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: HEIC-HEIF encoder saves corrupted files

Post by xnview »

winnylinny wrote: Thu Feb 17, 2022 7:03 pm However, when saving to HEIC format, it now results in an empty file (0B in size).
Strange it works here. On Windows 10? 0.99.7 x64?
Pierre.
User avatar
winnylinny
Posts: 167
Joined: Fri Apr 17, 2020 5:35 pm

Re: HEIC-HEIF encoder saves corrupted files

Post by winnylinny »

Yes.

Windows 10, 64bit, XnViewMP 0.997.

Replacing the heif.dll in the same folder with the one you linked results in 0B empty files. Placing the original hief.dll into the Plugins folder restores the same functionality (of the original but with corruption on certain images.)

EDIT: I will try again with the "portable" .zip version of XnViewMP.

UPDATE: Same issue with the portable version of XnViewMP 0.99.7 .zip. Replacing heif.dll with your newer heif.dll results in empty 0B files.
User avatar
xnview
Author of XnView
Posts: 46235
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: HEIC-HEIF encoder saves corrupted files

Post by xnview »

Right, please download it again?
Pierre.
User avatar
winnylinny
Posts: 167
Joined: Fri Apr 17, 2020 5:35 pm

Re: HEIC-HEIF encoder saves corrupted files

Post by winnylinny »

xnview wrote: Sun Feb 20, 2022 1:25 pm Right, please download it again?
It works with the new download! :D

Off topic: @view3r, why not use WebP instead of HEIC? WebP seems faster and is more cross-platform compatible, and it doesn't have the same legal grey areas as HEIC.
User avatar
xnview
Author of XnView
Posts: 46235
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: HEIC-HEIF encoder saves corrupted files

Post by xnview »

:bugconfirmed: Thanks to your detailed description I can reproduce the problem.
Pierre.
view3r
Posts: 4
Joined: Mon Jan 31, 2022 9:16 am

Re: HEIC-HEIF encoder saves corrupted files

Post by view3r »

winnylinny wrote: Sun Feb 20, 2022 2:28 pm
xnview wrote: Sun Feb 20, 2022 1:25 pm Right, please download it again?


Off topic: @view3r, why not use WebP instead of HEIC? WebP seems faster and is more cross-platform compatible, and it doesn't have the same legal grey areas as HEIC.
Thanks for the suggestion. However, after some googling, it seems webp is not that good in quality vs. filesize:
https://www.reddit.com/r/AV1/comments/j ... omparison/
User avatar
winnylinny
Posts: 167
Joined: Fri Apr 17, 2020 5:35 pm

Re: HEIC-HEIF encoder saves corrupted files

Post by winnylinny »

I understand in terms of "like for like" outright filesize efficiency, HEIC does edge out WebP.

However, there's more to an image format than simply sheer end-result filesize.
  • Cross-platform compatiblity
  • Decoder performance and speed
  • Adoption and website support
  • Legal issues (patents, legal grey areas, etc)
User avatar
xnview
Author of XnView
Posts: 46235
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: HEIC-HEIF encoder saves corrupted files

Post by xnview »

This problem is supposed to be fixed in XnView MP 1.00 beta. Please check and confirm the bug fix here.
Pierre.
view3r
Posts: 4
Joined: Mon Jan 31, 2022 9:16 am

Re: HEIC-HEIF encoder saves corrupted files

Post by view3r »

xnview wrote: Mon Mar 28, 2022 10:17 am This problem is supposed to be fixed in XnView MP 1.00 beta. Please check and confirm the bug fix here.
Thanks. The fix seems to be working. I was able to convert lots of photos without any corruption. Also exif data is preserved.
Post Reply