Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 785
Woozer Avatar asked Mar 13 '23 15:03

Woozer


1 Answers

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.

like image 166
Mark Setchell Avatar answered Apr 29 '23 21:04

Mark Setchell