strukturag / libheif

libheif is an HEIF and AVIF file format decoder and encoder.
Other
1.7k stars 298 forks source link

heif-enc issue wih black and white jpegs #604

Open MimoKar opened 2 years ago

MimoKar commented 2 years ago

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 ?

farindk commented 2 years ago

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?

MimoKar commented 2 years ago

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

farindk commented 2 years ago

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 commented 2 years ago

BTW: is this with HEIC output or AVIF?

MimoKar commented 2 years ago

here are examples. examples.zip

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

MimoKar commented 2 years ago

BTW: is this with HEIC output or AVIF?

HEIC

MimoKar commented 2 years ago

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

farindk commented 2 years ago

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.

MimoKar commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

Hi,

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

farindk commented 2 years ago

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

MimoKar commented 2 years ago

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

Thank you very much for your time.