convert issue

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
billaqrhos
Posts: 3
Joined: 2012-07-12T02:17:22-07:00
Authentication code: 13

convert issue

Post by billaqrhos »

Hi
I am new with image magick and i am facing a problem
When i use "convert a.png b.jpg -compose copy-opacity -composite rgba.png" i don't get the result i want.

All i want is to make a png file with transparency.

a.png
http://imageshack.us/photo/my-images/804/32023365.png/

b.jpg
http://imageshack.us/photo/my-images/822/35473814.jpg/

result rgba.png
http://imageshack.us/photo/my-images/543/rgba.png/

Can someone help me please?
Thank u
Bill
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert issue

Post by fmw42 »

copy opacity expects a grayscale image to put into the alpha channel and no alpha channel already in the other image. So convert your second image to grayscale or select one channel and be sure to disable alpha

convert a.png \( b.jpg -colorspace gray \) -alpha off -compose copy-opacity -composite rgba.png

On windows, leave off the \
billaqrhos
Posts: 3
Joined: 2012-07-12T02:17:22-07:00
Authentication code: 13

Re: convert issue

Post by billaqrhos »

fmw42 thank u for the reply but still with your command i get the same result as before!

Am i missing something?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert issue

Post by fmw42 »

billaqrhos wrote:fmw42 thank u for the reply but still with your command i get the same result as before!

Am i missing something?

Sorry converting to grayscale does not make the result appropriate, use the green channel and threshold it to binary. The best way to understand is to separate each channel of the two images and look at them and pick the one most suitable.


convert 32023365.png \( 35473814.jpg -channel g -separate +channel -threshold 50% \) -alpha off -compose copy_opacity -composite 1tmp1.png

Try that. It works for me on IM 6.7.8.2 Q16 Mac OSX Snow Leopard
billaqrhos
Posts: 3
Joined: 2012-07-12T02:17:22-07:00
Authentication code: 13

Re: convert issue

Post by billaqrhos »

fmw42 thank so much. U save me from lot of work.

Cheers!
Post Reply