Page 1 of 1
Extract Transparent Foreground From Image
Posted: 2016-04-04T14:51:25-07:00
by coolperez8
So, I have an original image and a modified version of the same image with a transparent foreground. Both images (including the foreground in the modified image) seem to have transparency. What I want to do is remove the original image portion from the modified image so I get the transparent foreground by itself with no traces of the original image. What command should I use to achieve this?
ImageMagick Version: ImageMagick 6.9.3-4 Q16 x64 2016-02-13 (Running on Windows 10)
Re: Extract Transparent Foreground From Image
Posted: 2016-04-04T15:13:19-07:00
by snibgo
I don't understand. If you remove the original image apart from the transparent foreground, what are you left with? Example images might help.
Please also read the
IMPORTANT: Please Read This FIRST Before Posting thread.
Re: Extract Transparent Foreground From Image
Posted: 2016-04-04T15:35:47-07:00
by coolperez8
Basically, you remove the original image from the modified image and you're left with the transparent foreground.
Re: Extract Transparent Foreground From Image
Posted: 2016-04-04T15:38:56-07:00
by snibgo
How about:
Code: Select all
convert in.png -alpha transparent out.png
Re: Extract Transparent Foreground From Image
Posted: 2016-04-04T15:43:36-07:00
by coolperez8
snibgo wrote:How about:
Code: Select all
convert in.png -alpha transparent out.png
That did not work, it just made the entire image transparent.
Plus, I am trying to remove a known background of an image that has a transparent foreground.
Re: Extract Transparent Foreground From Image
Posted: 2016-04-04T17:33:18-07:00
by fmw42
If you just want the alpha channel of the image (transparency) use
Code: Select all
convert image.png -alpha extractf alphachannel.png
Re: Extract Transparent Foreground From Image
Posted: 2016-04-05T13:10:35-07:00
by coolperez8
fmw42 wrote:If you just want the alpha channel of the image (transparency) use
Code: Select all
convert image.png -alpha extractf alphachannel.png
Actually, what I'm trying to do is remove a known background from an image, although the foreground is transparent.
Re: Extract Transparent Foreground From Image
Posted: 2016-04-05T16:38:35-07:00
by fmw42
If you remove the background channels, all you are left with is the alpha channel.
If you want the background area of the image to be removed in the sense of making it black (or white or some other color), leaving the opaque foreground and transparency still where the background exists, then use
Code: Select all
convert image -background black -alpha background result