png transparent background is black

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?".
paphus
Posts: 13
Joined: 2015-08-19T07:18:29-07:00
Authentication code: 1151

Re: png transparent background is black

Post by paphus »

If I use "identify -verbose" and compare the original image, with the converted one, the alpha difference is,

original (that gives transparent webm) - Alpha: none #00000000
converted (that is white background) - Alpha: srgba(255,255,255,0) #FFFFFF00

So, how do I make the Alpha - none #00000000
?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: png transparent background is black

Post by fmw42 »

try

Code: Select all

convert image -background black -alpha background newimage
paphus
Posts: 13
Joined: 2015-08-19T07:18:29-07:00
Authentication code: 1151

Re: png transparent background is black

Post by paphus »

Doh, okay I figured it out. My images were good, but I somehow have two different versions of ffmpeg on my computer and was using the wrong one that doesn't seem to support transparency.

Now it is working.

My only issue is the last shell line,

for /f %x in ('dir /s /b blink*.png') do @composite -compose CopyOpacity mask-0.png %x %x

This only uses mask-0.png, instead of mask-1 for blink01.png, mask-2 for blink02.png etc.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: png transparent background is black

Post by fmw42 »

You will need to change the -x in a variable for the mask-x.png image in your loop. I do not know what the @ is before composite. It is not IM syntax. Is this on Windows or Unix? Looks more like Windows syntax.
paphus
Posts: 13
Joined: 2015-08-19T07:18:29-07:00
Authentication code: 1151

Re: png transparent background is black

Post by paphus »

windows, here is my final script,

for /f %x in ('dir /s /b talk*.png') do @convert -alpha extract %x %x-mask.png
mogrify -flatten talk*.png
for /f %x in ('dir /s /b talk*.png') do @composite -compose CopyOpacity %x-mask.png %x %x

works, end result here,
http://www.botlibre.com/avatar?id=1115544
Post Reply