how to set the opecity when composimg png files?

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
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

how to set the opecity when composimg png files?

Post by linjuming »

how to set the top png file's opacity when it is composed on top to the background png file? like the same work in PS.
Image
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: how to set the opecity when composimg png files?

Post by linjuming »

the command line below can set the opacity for top png when "-compose dissolve" :
convert 1.png 2.png -alpha on -compose dissolve -define compose:args=50 -composite hello.png

but there is no use when "-compose overlay" :
convert 1.png 2.png -alpha on -compose overlay -define compose:args=50 -composite hello.png
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: how to set the opecity when composimg png files?

Post by linjuming »

refer to this post:
viewtopic.php?f=1&t=17503&p=65756&hilit=opacity#p65756

source psd file description:
Image

source png files:
Image
Image

my code:

Code: Select all

convert 1.png ( 2.png -alpha set -channel A -evaluate set 40% ) -compose overlay -composite hello.png
result: hello.png
Image

the result is the same with the 1.png? why
Last edited by linjuming on 2011-02-11T06:18:04-07:00, edited 2 times in total.
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: how to set the opecity when composimg png files?

Post by linjuming »

Image


Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to set the opecity when composimg png files?

Post by fmw42 »

On windows you do not escape the ( ) with \, just use the parenthesis alone. Please read http://www.imagemagick.org/Usage/windows/
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: how to set the opecity when composimg png files?

Post by linjuming »

Thanks ,and why can not i create the right result using this code?

Code: Select all

convert 1.png ( 2.png -alpha set -channel A -evaluate set 40% ) -compose overlay -composite hello.png
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to set the opecity when composimg png files?

Post by fmw42 »

convert 1.png ( 2.png -alpha set -channel A -evaluate set 40% ) -compose overlay -composite hello.png
try

convert 1.png ( 2.png -alpha set -channel A -evaluate set 40% ) -compose over -composite hello.png

You must have a space after ( and before ).


This works for me on my Mac/Unix system and looks similar to your PS result:

convert 1.png \( 2.png -alpha set -channel A -evaluate set 40% \) -compose over -composite result.png
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: how to set the opecity when composimg png files?

Post by linjuming »

convert 1.png ( 2.png -alpha set -channel A -evaluate set 40% ) -compose over -composite hello.png

result still as the same as 1.png
I made sure that space before and after ( ) ,the code is compeletely copyed from your code.

seems many problem running at my end ....
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: how to set the opecity when composimg png files?

Post by linjuming »

Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to set the opecity when composimg png files?

Post by fmw42 »

what version of IM are you using?

identify -version
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to set the opecity when composimg png files?

Post by fmw42 »

run the command line in a command window by typing or pasting and not from a Bat file.
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: how to set the opecity when composimg png files?

Post by linjuming »

Image
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: how to set the opecity when composimg png files?

Post by linjuming »

Image

So,finally, it must be the problem with my text editor "notepad++".
by the way, what is the time at your end now? for sometimes i post probems at daytime but no one reply.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to set the opecity when composimg png files?

Post by fmw42 »

I am on the west coast of the US and the time now is 9 PM (GMT-8).
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: how to set the opecity when composimg png files?

Post by linjuming »

Thanks a million , now is 1 pm at my end.
Post Reply