Search code examples
imagegraphicsmagickdithering

Floyd Steinberg dithering in GraphicsMagic or ImageMagic


I'm having trouble converting images to 1bit dithered images using GraphicsMagic. The converted images are to be used as input for a thermal printer.

I'm using the following command:

gm convert input.jpg -resize 384 -monochrome -dither out.bmp

The result is a 1bit dithered image, but the quality is different then e.g. a dithered image from GIMP, The GIMP (or resulting images from other programs) image looks slightly better.

Does anyone have tips to achieve the same results? (I have experimented with other GraphicsMagic options, but to no avail)

Original

ORIGINAL

GraphicsMagick

GM

GIMP

GIMP


Solution

  • You can dither in a fashion closer to GIMP using this command:

    convert scooter.png -resize 384 -dither FloydSteinberg -remap pattern:gray50 scooter_d.gif
    

    enter image description here

    By the way, you can get rather good results using an ordered dither like this:

    convert scooter.png -colorspace gray -ordered-dither o8x8 result.gif
    

    enter image description here

    Kudos to Anthony Thyssen who wrote the excellent ImageMagick Usage pages - Quantisation with ImageMagick.