[RESOLVED] change in behaviour of -colorize

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

[RESOLVED] change in behaviour of -colorize

Post by fmw42 »

IM 6.7.6.6 Q16 Mac OSX Snow Leopard

I am trying to fix a script, magicwand, that suddenly stopped working. I have traced it down to a change in behavior for -colorize. (Perhaps due to my request recently that the use of -fill none promote an alpha channel). Nevertheless, my attempts to change the offending line code in my script have met with limited/puzzling results.

Image

In IM ImageMagick-6.7.4-10, the following worked fine (as I have backed down my version to test it)

convert logo2.png -fuzz 25% -fill none -draw "matte 160,200 floodfill" -write show: -fill black -colorize 100% show:

The first show: indicates that -draw is working correctly. The second show: (final result) is black everywhere, except transparent in the arm and lower body:

Image


However in the current IM version 6.7.6.6, the second show: (i.e. result) is totally black.


In an attemp to work around it, I have tried 4 different approaches. The first 3 fail with totally black results, but the last one, though rather complex does work. I am puzzled why the first 3 do not work.

convert logo2.png -fuzz 25% -fill none -draw "matte 160,200 floodfill" -write show: -channel rgb -fill black -colorize 100% +channel show:

convert logo2.png -fuzz 25% -fill none -draw "matte 160,200 floodfill" -write show: -alpha off -fill black -colorize 100% -alpha on show:

convert logo2.png -fuzz 25% -fill none -draw "matte 160,200 floodfill" -write show: -channel rgb -alpha off -fill black -colorize 100% +channel -alpha on show:

convert logo2.png -fuzz 25% -fill none -draw "matte 160,200 floodfill" -write show: -channel a -negate +channel -background black -alpha background -channel a -negate +channel show:


Have I missed or misunderstood something?

Is there a shorter/better way to make this work again other than my last method above?

Is -colorize seeing the -fill none at the beginning and overlooking the -fill black towards the end just before it?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: [RESOLVED] change in behaviour of -colorize

Post by fmw42 »

I found a shorter way around it.


im6 convert logo2.png -fuzz 25% -fill none -draw "matte 160,200 floodfill" -write show: -fill "rgba(0,0,0,0)" +opaque none show:
or
im6 convert logo2.png -fuzz 25% -fill none -draw "matte 160,200 floodfill" -write show: -fill black +opaque none show:
Post Reply