Kjuuze wrote:Now i need to combine them to one image (as layers one on top of the other) with different opacity values (a.png 0.9, b.png 0.5, c.png 0.6). The new image should be a transparent png too.
I'm using Windows 7 64, PhotoShop Elements 8.0, and "ImageMagick 6.9.3-6 Q16 x64".
I made a 3 layer image in PS using your "a.png", "b.png", and "c.png". I set the "a.png" layer to 90% opaque, the "b.png" layer over it to 50% opaque, and the "c.png" layer over that to 60% opaque. I merged down the layers and saved it as a PNG image to compare.
Then I did this "convert" command with IM...
Code: Select all
convert ^
-background none ^
-compose blend ^
( -define compose:args=90 ( a.png -channel a -evaluate set 0 ) a.png -composite ) ^
( -define compose:args=50 ( b.png -channel a -evaluate set 0 ) b.png -composite ) ^
( -define compose:args=60 ( c.png -channel a -evaluate set 0 ) c.png -composite ) ^
-compose over ^
-flatten output.png
The results were virtually identical to the PS process. The "convert" command goes something like this...
Start by setting the background color as "none".
Set the compose method to "blend".
Set the blend level at 90% opaque. Create a transparent image from the "a.png" and blend composite "a.png" over it.
Set the blend level at 50% opaque. Create a transparent image from the "b.png" and blend composite "b.png" over it.
Set the blend level at 60% opaque. Create a transparent image from the "c.png" and blend composite "c.png" over it.
Set the compose method to "over".
Flatten the three images into a single PNG named "output.png".
If you're on a *nix OS you'll probably have to escape those parentheses with a backslash "\" and replace the continued line carets "^" with a backslash "\" too. I'm not sure if it'll need a couple other syntax tweaks, but that should get pretty close.