processing keeping the alpha channel

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
fmw42
Posts: 25664
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

processing keeping the alpha channel

Post by fmw42 » 2012-08-18T17:21:55-07:00

Using this image at http://i50.tinypic.com/110ke9i.png in IM 6.7.9.0 Q16 Mac OSX Snow Leopard

This works fine:

convert 110ke9i.png -background black -alpha background \
\( -clone 0 -alpha off -median 7x7 \) \
\( -clone 0 -alpha extract \) \
-delete 0 -alpha off -compose copy_opacity -composite 110ke9i_new.png

But neither of these seem to work. They seem to lose the alpha channel. What am I missing or misunderstanding?

convert 110ke9i.png -background black -alpha background -alpha off -median 7x7 -alpha on 110ke9i_new2.png

convert 110ke9i.png -background black -alpha background -channel rgb -median 7x7 -channel rgba -alpha on 110ke9i_new2.png

User avatar
magick
Site Admin
Posts: 11078
Joined: 2003-05-31T11:32:55-07:00

Re: processing keeping the alpha channel

Post by magick » 2012-08-18T17:58:53-07:00

You'll need to add -channel rgba before the -median option plus a patch is needed. Look for it in ImageMagick 6.7.9-1 Beta, available sometime tomorrow.

User avatar
fmw42
Posts: 25664
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: processing keeping the alpha channel

Post by fmw42 » 2012-08-18T18:01:42-07:00

magick wrote:You'll need to add -channel rgba before the -median option plus a patch is needed. Look for it in ImageMagick 6.7.9-1 Beta, available sometime tomorrow.
No rush.

Why the need for -channel rgba as I do not want to filter the alpha channel? So I thought I either needed to turn off alpha or restrict the median to -channel rgb

Also I note that I get the same bad result from -statistic median 7x7.

Post Reply