Page 1 of 1

how to set the opecity when composimg png files?

Posted: 2011-02-11T01:42:52-07:00
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

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

Posted: 2011-02-11T01:48:27-07:00
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

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

Posted: 2011-02-11T06:01:33-07:00
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

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

Posted: 2011-02-11T06:12:04-07:00
by linjuming
Image


Image

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

Posted: 2011-02-11T15:31:39-07:00
by fmw42
On windows you do not escape the ( ) with \, just use the parenthesis alone. Please read http://www.imagemagick.org/Usage/windows/

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

Posted: 2011-02-11T19:07:38-07:00
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

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

Posted: 2011-02-11T19:44:35-07:00
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

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

Posted: 2011-02-11T20:06:52-07:00
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 ....

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

Posted: 2011-02-11T20:16:50-07:00
by linjuming
Image

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

Posted: 2011-02-11T20:41:57-07:00
by fmw42
what version of IM are you using?

identify -version

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

Posted: 2011-02-11T20:49:01-07:00
by fmw42
run the command line in a command window by typing or pasting and not from a Bat file.

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

Posted: 2011-02-11T21:06:16-07:00
by linjuming
Image

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

Posted: 2011-02-11T21:14:57-07:00
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.

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

Posted: 2011-02-11T22:08:25-07:00
by fmw42
I am on the west coast of the US and the time now is 9 PM (GMT-8).

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

Posted: 2011-02-11T22:23:15-07:00
by linjuming
Thanks a million , now is 1 pm at my end.