Page 1 of 1

Alpha channel extraction

Posted: 2012-10-21T03:56:07-07:00
by edwin
I have a script that does a lot of alpha channel modifications. This worked fine until the distro upgraded ImageMagick from a 6.6 version to 6.7.7 (PerlMagick 6.77). After that, everything was messed up.

I found that this had to do with changes in colorspace handling and managed to get some of the things (like linear gradients) back to working order. However, I can't seem to get alpha channel extraction to work right. I reduced the problem to the following:

Code: Select all

my $img = Image::Magick->new;
my $alpha = $img->Clone();
$img->Composite(image=>$alpha, compose=>'CopyOpacity');
Since I don't really change anything, I should end up with the same image. But no matter what I do, the alpha channel keeps changing with what looks like sRGB/RGB conversion. Is there actually something that can make this work or is there some fatal flaw at work here?

Re: Alpha channel extraction

Posted: 2012-10-23T15:26:23-07:00
by edwin
I did some digging in the code. If I read it correctly, Set(colorspace=>'RGB') is actually tied to the "-colorspace RGB" command. If this is correct, then I have been unable to find something equivalent to "-set colorspace RGB", which would be a big problem now.

I also found a workaround. I dug up a file "Adobe98.icc" under creative commons. Now I can get normal alpha scales back with