libheif icon indicating copy to clipboard operation
libheif copied to clipboard

heif-enc issue wih black and white jpegs

Open MimoKar opened this issue 3 years ago • 13 comments

Hi,

full color JPG images I can convert properly, but the b&w are always black - when opened in irfanview or in some other tool. When opened on ImageMagick, then it is shown fine.

Images converted by ImageMagick(on Linux) are fine.

Tested on Windows with the latest build 1.12

I am missing some special switch there, or it is a bug ?

MimoKar avatar Feb 19 '22 15:02 MimoKar

If the encoded B/W images open fine in ImageMagick but not in IrfanView, it sounds like a bug in IrfanView. Or did I misunderstand the issue?

farindk avatar Feb 19 '22 17:02 farindk

The same happens for android viewers, not only irfanview. Files created with ImageMagick are working fine everywhere.

MimoKar avatar Feb 19 '22 18:02 MimoKar

Could you attach an example image, encoded both with heif-enc and ImageMagick to let me examine the difference? It's a bit strange since ImageMagick is also using libheif internally.

farindk avatar Feb 19 '22 18:02 farindk

BTW: is this with HEIC output or AVIF?

farindk avatar Feb 19 '22 18:02 farindk

here are examples. examples.zip

i tried other b&w image and it is shown properly after encoding ...

MimoKar avatar Feb 19 '22 19:02 MimoKar

BTW: is this with HEIC output or AVIF?

HEIC

MimoKar avatar Feb 19 '22 19:02 MimoKar

Some observation: the other one which was encoded properly in both ways - file sizes are same. The wrong one differs ...

MimoKar avatar Feb 19 '22 19:02 MimoKar

The image encoded by ImageMagick is not really a greyscale image. It is a color image with empty color planes. It seems to convert the greyscale input to color first. heif-enc on the other hand, encodes the input to real greyscale HEICs.

Thus, I still think that the problem is that IrfanView and other viewers cannot display greyscale HEIF images.

farindk avatar Feb 19 '22 19:02 farindk

2heifenc.zip this one is shown properly by irfanview and others tool - encoded by heicenc.

It is hard to believe that the near all android applications and the one of the most popular apps will be broken...

MimoKar avatar Feb 19 '22 20:02 MimoKar

I just remembered, irfanview is using a windows component to show the HEIF files, so it is not his problem with decoding. Is there a way how to force color compression instead of b&w for HEIC encoder ?

MimoKar avatar Feb 21 '22 10:02 MimoKar

Hi,

this build libheif-1.6.2-r1106-g3824054 is producing correct (visible in irfanview) results for my first example.

MimoKar avatar Feb 21 '22 17:02 MimoKar

libheif-1.6.2 didn't produce greyscale output yet. We need a heif-enc option to always convert to color.

farindk avatar Feb 21 '22 17:02 farindk

Then I will use this one till it will be extended with new parameter.

Thank you very much for your time.

MimoKar avatar Feb 21 '22 18:02 MimoKar