Reduce color depth and dither?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
NimaiMalle
Posts: 3
Joined: 2013-02-02T16:53:40-07:00
Authentication code: 6789

Reduce color depth and dither?

Post by NimaiMalle »

I tried all of the following, but the resulting image has color bands - no dithering.

Code: Select all

convert Sample.png -depth 4 Sample2.png 
convert Sample.png -depth 4 -dither FloydSteinberg Sample2.png 
convert Sample.png -depth 4 +dither Sample2.png 
Image => Image

Any suggestions appreciated!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Reduce color depth and dither?

Post by snibgo »

convert Sample.png -colors 16 Sample2.png
snibgo's IM pages: im.snibgo.com
NimaiMalle
Posts: 3
Joined: 2013-02-02T16:53:40-07:00
Authentication code: 6789

Re: Reduce color depth and dither?

Post by NimaiMalle »

snibgo wrote:convert Sample.png -colors 16 Sample2.png
Thanks for the reply. A 16 color pallet is different than a color depth of 4, 16-bit RGBA.
Still looking for way to get that to dither...
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Reduce color depth and dither?

Post by snibgo »

Ah, sorry. "-remap" can dither, and can use the colours from your Sample2:

Code: Select all

convert Sample.png -depth 4 Sample2.png 
convert Sample.png -remap Sample2.png Sample3.png
Is Sample3.png what you want?
snibgo's IM pages: im.snibgo.com
NimaiMalle
Posts: 3
Joined: 2013-02-02T16:53:40-07:00
Authentication code: 6789

Re: Reduce color depth and dither?

Post by NimaiMalle »

Fascinating. There are some peculiar artifacts but it did indeed dither.
Image
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Reduce color depth and dither?

Post by anthony »

Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply