Page 1 of 1

Just need a little help with the stack I think

Posted: 2011-02-18T10:55:31-07:00
by jonfhancock
OK, I have two images to work with in the beginning, and I have three successful commands to get me to the finished result. I am trying to combine the commands down to one and avoid temporary images.

The starting images are:
android.png
Image

and concentric.png
Image

The first command uses the android as an alpha channel mask so I end up with an android cutout of concentric.png including the drop shadow

Code: Select all

convert concentric.png android.png -alpha Set -compose Dst_In -composite android-con.png
The result is android-con.png
Image

But it is a little too transparent, so the next command just doubles it up

Code: Select all

convert android-con.png \( +clone \) -composite android-dub.png
Which yields android-dub.png
Image

But, I want to bring in a white glow in place of the blue drop shadow to help define the lines a little better, so I run:

Code: Select all

convert android.png -negate android-con.png -composite android-final.png
Which yields the final result android-final.png
Image


Now for combining them:

I started with bringing it down to two commands:

Code: Select all

convert concentric.png android.png -alpha Set -compose Dst_In -composite android-con.png

convert android.png -negate \( android-con.png \( +clone \) -composite \) -composite android-final.png
Which works great. But, when I try to replace "android-con.png" with the first command, the image comes out wrong.

Code: Select all

convert android.png -negate \( \( concentric.png android.png -alpha Set -compose Dst_In -composite \) \( +clone \) -composite \) -composite android-fail.png
Yields android-fail.png
Image

I'm sure I'm misunderstanding either the way parentheses work, or the way +clone works. Any advice?

Thanks,

Jon F Hancock

Re: Just need a little help with the stack I think

Posted: 2011-02-18T11:12:04-07:00
by fmw42
try adding -respect-parenthesis at the beginning after convert in case -negate is creaping into the parenthese. Just a guess.

and/or

replace

android.png -negate

with

\( android.png -negate \)

Re: Just need a little help with the stack I think

Posted: 2011-02-18T12:00:41-07:00
by jonfhancock
That actually gets me pretty close. This command:

Code: Select all

convert -respect-parenthesis android.png -negate \( \( concentric.png android.png -alpha Set -compose Dst_In -composite \) \( +clone \) -composite \) -composite android-fail.png
Yields:
android-fail2.png
Image

Which is just a little darker than android-final.png
Image


It sort of looks like the order is wonky, or the way it is composited is not quite right. I've tried reordering things, taking out parenthesis, and adding parenthesis, but can't seem to get any better result. Hmm

Re: Just need a little help with the stack I think

Posted: 2011-02-18T21:10:47-07:00
by anthony
fmw42 wrote:try adding -respect-parenthesis at the beginning after convert in case -negate is creaping into the parenthese. Just a guess.
-negate is an operator, it is applied, not remembered.

Re: Just need a little help with the stack I think

Posted: 2011-02-18T21:16:18-07:00
by anthony
The very dirst command shoudl have done teh job...

Code: Select all

convert concentric.png android.png -alpha Set -compose Dst_In -composite android-con.png
The problem is that you are removing most of the darker parts of the concentric image, as they fall outside the android shape, and as such the whole image looks so much lighter than it really is.

I would suggest take the result of the above and just 'darken' it a little more using -level, sigmoidal-conrast, or -module.
That later can adjust both luminance and saturation to get the result you want.

Question are you sure your androis shape isn't semi-transparent! That would also be the cause of your problems!!
In which case do a level adjustment of just the alpha channel and fix its transparency!

Re: Just need a little help with the stack I think

Posted: 2011-03-10T21:41:43-07:00
by jonfhancock
Thanks, anthony!

The android is semi-transparent. I've been reading through the imagemagick documentation, but I can't seem to grok how to adjust only the alpha channel. Do you have an example handy?

Thanks,

Jon

Re: Just need a little help with the stack I think

Posted: 2011-03-11T01:28:58-07:00
by Drarakel
If you still wonder why the combining of your original commands wasn't completely successful: As you first use a special compositing method, you have to change it back to the default ("-compose src-over") right before the second composite. Personally, I would also avoid nested parentheses as long as possible (though that was not the reason for the differing results).

So, an equivalent for your two commands..
jonfhancock wrote:I started with bringing it down to two commands:

Code: Select all

convert concentric.png android.png -alpha Set -compose Dst_In -composite android-con.png

convert android.png -negate \( android-con.png \( +clone \) -composite \) -composite android-final.png
..would be that:

Code: Select all

convert concentric.png android.png -alpha Set -compose Dst_In -composite -compose src-over +clone -composite ( android.png -negate ) +swap -composite android-final2.png