imagemagickditheringcolor-depthirfanview

How to replicate IrfanView's colordepth reduction using ImageMagick?


I usually use IrfanView v4.62 to decrease colour depth for PNG images to 4 bits per pixel. But I now need to use ImageMagick v7 because I need to cron a batch job on Linux (CentOS 7.9). IrfanView doesn't run on Linux (except on Wine, which is not feasible for me).

Problem: I'm unable to replicate the results of Irfanview using ImageMagick.

What I did on IrfanView:

What I tried on ImageMagick:

None of the ImageMagick options I chose could produce the quality of color-reduced image that IrfanView could. IrfanViews results were "smoother" and closer to the original.

Does anyone know the equivalent options for magick to achieve the results of IrfanView as described?

(The reason for wanting to reduce color depth is to reduce filesize by 10x, more or less.)

Thank you.

Edit: Here are 3 images for comparison:

Original image: dd.png (739KB)

Processed by IrfanView: dd-irfanview-depth4.png (86KB)

Processed by ImageMagick: dd-magick-colors16.png (67KB)


Solution

  • I think this command produces an even better result than IrfanView - though I would have to question the point of using PNG format for a photo-like image - why not JPEG?

    Anyway:

    magick input.png -dither FloydSteinberg -colors 16 result.png
    

    enter image description here