Help with dithering

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?".
SharkD
Posts: 35
Joined: 2006-07-30T13:18:31-07:00

Post by SharkD »

anthony wrote: You mentioned having problems with -monochrome, not -ordered dither.

That is correct. However, I am experimenting with both methods.
anthony wrote: What version of IM are you using?

Whatever is the latest available for Windows. I just downloaded it about a week ago.
anthony wrote: PS: why are you overlaying you image onto blue? Why not just do

Code: Select all

convert  image_new   -background blue  -flatten   image_flattened

Thanks!

Now I've got this:

Code: Select all

convert %InName% ( -channel A -ordered-dither 2x1 ) ( -compose CopyOpacity -composite ) %OutName%
convert %OutName% ( -background blue -flatten ) %OutName%
convert %OutName% ( -transparent blue ) %OutName%
However, I still can't get it all on one line :(.
The reason I want it all on one line is, that with three lines it takes almost 10mins to run the above batch file over a directory full of images. Having it all on one line runs faster.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Post by glennrp »

SharkD wrote: Now I've got this:

Code: Select all

convert %InName% ( -channel A -ordered-dither 2x1 ) ( -compose CopyOpacity -composite ) %OutName%
convert %OutName% ( -background blue -flatten ) %OutName%
convert %OutName% ( -transparent blue ) %OutName%
However, I still can't get it all on one line :(.
The reason I want it all on one line is, that with three lines it takes almost 10mins to run the above batch file over a directory full of images. Having it all on one line runs faster.


You already have it on one line. Just delete the second and third lines, which don't actually do anything (it looks like they just convert the background from transparent to blue and back to transparent).
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

You are mis-using parenthesis. They are for working on extra images on the size. You don't read or clone any images into the parenthese, so they dont do any good.

Also -channel limits itself to the given channel. You don't need to copy it back.
-monochrome for not follow channel setting so it needs to extract do the job and return the alpha channel, -order-dither does not need this.

Code: Select all

convert %InName% -channel A -ordered-dither 2x1 %OutName%
This is what is outlined in the GIF dithered transparency examples which I pointed out to you before.
http://www.cit.gu.edu.au/~anthony/raphi ... ts/#dither
NOTE that -monochrome and -ordered-dither are used in very different ways!

The dither and color reduction examples are norm been enlarged to its own seperate section, and still have a lot more to add.
http://www.cit.gu.edu.au/~anthony/graph ... e/#bitmaps
See the above 'bitmap' operators on this page.

The GIF dithered transparency section will move to its own area on this page in the next week or so, do don't worry if it 'dissappears.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply