Split RGB+alpha and compose back

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
soulburner
Posts: 2
Joined: 2014-04-04T13:10:46-07:00
Authentication code: 6789

Split RGB+alpha and compose back

Post by soulburner »

I'm getting a little crazy here...

I want to do simple thing.

1. split my transparent PNG into 2 images - RGB + grayscale alpha
(do something)
2. compose them back

So, for now I don't do anything between steps 1 and 2, but it doesn't work.

My code is:

Code: Select all

convert in.png -channel Alpha -separate a.png
convert in.png -channel alpha -threshold 100%% +channel rgb.bmp
This part is ok. I get RGB without transparancy and alpha channel as a grayscale image.

But when I try to combine them back, I loose all my semi-transparent pixels:

Code: Select all

convert rgb.bmp a.png -alpha off -compose CopyOpacity -composite PNG32:result.png
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Split RGB+alpha and compose back

Post by snibgo »

It works fine for me, with IM 6.8.8-7 on Windows 8.1. What version and platform are you on?
snibgo's IM pages: im.snibgo.com
soulburner
Posts: 2
Joined: 2014-04-04T13:10:46-07:00
Authentication code: 6789

Re: Split RGB+alpha and compose back

Post by soulburner »

Ahhh.... I've just updated imagemagick and it works fine now... Thank you :)
Post Reply