Page 1 of 2

ordered dither checks and remapping possible?

Posted: 2018-10-03T08:16:50-07:00
by mattyrb
Hi,
I've been playing with dithering and remapping. I have images I want to reduce to a selected 16 colours from a colourmap of 512. I've got all that working nicely. However I'd like to use -ordered-dither checks rather than Riemersma or FloydSteinberg. Is this possible?

Best wishes,
Matt

Re: ordered dither checks and remapping possible?

Posted: 2018-10-03T09:49:22-07:00
by snibgo
Riemersma and FloydSteinberg are error-diffusion methods. "-ordered-dither" is a dither with no error diffusion. So I don't understand the question.

Re: ordered dither checks and remapping possible?

Posted: 2018-10-03T13:05:49-07:00
by mattyrb
Okay I'm trying to remap an image to a colourmap of 512 then order dither it using checks to 16 colours?

Re: ordered dither checks and remapping possible?

Posted: 2018-10-03T13:52:51-07:00
by snibgo
Sorry, I still don't understand. "-ordered-dither" makes each pixel either "on" or "off", so it can only make 8 colours, which are: black, white, red, green, blue, cyan, magenta and cyan.

It can't make 16 colours, or colours of your choosing. See http://www.imagemagick.org/Usage/quanti ... red-dither

Can you show an example of what you want?

Re: ordered dither checks and remapping possible?

Posted: 2018-10-03T14:16:56-07:00
by mattyrb
I literally want to reduce my images to 16 colours but use a dither pattern that's consistent

Re: ordered dither checks and remapping possible?

Posted: 2018-10-03T14:42:52-07:00
by snibgo
Consistent in what sense?

If you want to reduce an image to 16 colours that you choose, then "-remap" will do that. But each pixel is assigned the closest of the 16 colours, either with error-diffusion dithering, or no with dithering. IM has no simple method for ordered-dithering with 16 chosen colours.

Re: ordered dither checks and remapping possible?

Posted: 2018-10-03T14:59:03-07:00
by mattyrb
When I say consistent the dither pattern needs to be consistent obviously error-diffusion is too random :lol:

Re: ordered dither checks and remapping possible?

Posted: 2018-10-03T15:06:00-07:00
by fmw42
mattyrb wrote: 2018-10-03T14:59:03-07:00 When I say consistent the dither pattern needs to be consistent obviously error-diffusion is too random :lol:
I suspect he means the same unique pattern over the whole image, i.e. an ordered-dither

Re: ordered dither checks and remapping possible?

Posted: 2018-10-03T15:07:54-07:00
by mattyrb
fmw42 wrote: 2018-10-03T15:06:00-07:00
mattyrb wrote: 2018-10-03T14:59:03-07:00 When I say consistent the dither pattern needs to be consistent obviously error-diffusion is too random :lol:
I suspect he means the same unique pattern over the whole image, i.e. an ordered-dither
Yes! Sorry. I'm really new to image processing!

Re: ordered dither checks and remapping possible?

Posted: 2018-10-03T15:15:07-07:00
by fmw42

Re: ordered dither checks and remapping possible?

Posted: 2018-10-03T15:20:11-07:00
by fmw42
Also see the section https://imagemagick.org/Usage/quantize/#od_posterize for comparison of different methods.

Re: ordered dither checks and remapping possible?

Posted: 2018-10-03T15:26:03-07:00
by mattyrb
Order-dither is definitely what I'm after but I can't fathom how to restrict it to 16 colours? It looks like you can only restrict to RGB steps?

-ordered-dither checks,8,8,8 is what I have at present but I then have to run a quantize to reduce the colouring but that can't be right surely!

Re: ordered dither checks and remapping possible?

Posted: 2018-10-03T15:34:49-07:00
by fmw42
I am not a dithering expert. But you could reduce the colors to 16 using +dither -colors 16, then do you ordered dither

Code: Select all

convert inputimage +dither -colors 16 -ordered-dither checks,8,8,8 outputimage
The +dither before -colors turns off dithering for reducing colors.

Alternately, you could create a 16 color colormap image

convert xc:color1 xc:color2 .... xc:color16 +append colormap.gif


and then do

Code: Select all

convert inputimage +dither -remap colormap.gif -ordered-dither checks,8,8,8 outputimage

Re: ordered dither checks and remapping possible?

Posted: 2018-10-03T16:20:44-07:00
by fmw42
Please always provide your IM version and platform/OS, since syntax may vary.

Re: ordered dither checks and remapping possible?

Posted: 2018-10-03T16:23:02-07:00
by mattyrb
Thanks I'll post back in the morning :)