[solved] Dithering from 48bit (to 24bit) image not possible?

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
LDAsh
Posts: 35
Joined: 2015-04-28T06:10:58+00:00
Authentication code: 6789

[solved] Dithering from 48bit (to 24bit) image not possible?

Post by LDAsh »

I'm certain it is, because I've done it from 16-bit greyscale to 8-bit greyscale here:-
http://www.imagemagick.org/discourse-se ... 5dc9c07e6f

Code: Select all

magick image24.png -depth 16 -define png:format=png48 -define png:compression-level=1 -define png:compression-filter=1 -define png:compression-strategy=2 png48:image48.png
magick image48.png -depth 16 -define png:format=png48 -define png:compression-level=1 -define png:compression-filter=1 -define png:compression-strategy=2 -blur 2x6 -blur 3x9 -depth 16 png48:image48b.png
magick image48b.png -depth 16 -define png:format=png48 -define png:compression-level=1 -define png:compression-filter=1 -define png:compression-strategy=2 -motion-blur 99x99+0 -depth 16 png48:image48b_.png
magick image48b_.png -depth 8 -define png:format=png48 -define png:compression-level=1 -define png:compression-filter=1 -define png:compression-strategy=2 -dither Riemersma -colors 16777215 png24:image48z.png
(using "Version: ImageMagick 7.0.7-28 Q16 x64 2018-03-25")

Any help with this BAT file would be appreciated. Either it just doesn't work, or I'm doing something obviously stupid?
Last edited by LDAsh on 2020-11-09T04:51:23+00:00, edited 1 time in total.
LDAsh
Posts: 35
Joined: 2015-04-28T06:10:58+00:00
Authentication code: 6789

Re: Dithering from 48bit (to 24bit) image not possible?

Post by LDAsh »

Well, I've concluded that it doesn't work!
However, the obvious solution to this is to split the colour channels and do the dithering separately, then combine again:-

Code: Select all

magick image24.png -resize 4096x2048 -define png:format=png48 png48:image48.png
magick image48.png -blur 3x9 -depth 16 -define png:format=png48 png48:image48b.png
magick image48b.png -motion-blur 33x33+90 -depth 16 -define png:format=png48 png48:image48c.png

magick image48c.png -channel R -separate -depth 16 -define png:format=png48 png48:image48c_red.png
magick image48c.png -channel G -separate -depth 16 -define png:format=png48 png48:image48c_grn.png
magick image48c.png -channel B -separate -depth 16 -define png:format=png48 png48:image48c_blu.png

magick image48c_red.png -dither riemersma -colors 255 image48c_red2.png
magick image48c_grn.png -dither riemersma -colors 255 image48c_grn2.png
magick image48c_blu.png -dither riemersma -colors 255 image48c_blu2.png

magick image48c_red2.png -resize 2048x1024 -define png:format=png24 png24:image48c_red3.png
magick image48c_grn2.png -resize 2048x1024 -define png:format=png24 png24:image48c_grn3.png
magick image48c_blu2.png -resize 2048x1024 -define png:format=png24 png24:image48c_blu3.png

magick image48c_red3.png image48c_grn3.png image48c_blu3.png -combine -set colorspace sRGB -define png:format=png24 png24:image48d!!!.png
This gives me the result I was looking for. :D
http://www.violae.net/temp/48to24dither.jpg
Post Reply