Page 1 of 1

Command combination conflict, why? [SOLVED]

Posted: 2016-02-19T16:02:31-07:00
by weblife
Hello,

I get all kinds of alpha issue with the layers after i combine four commands. Ran individually they output correctly but when combined I get the issue at hand.

I am using ImageMagick 6.9.1-10 Q16 x86_64 2015-07-26 in Term2 on OSX El Capitan.

Individual Commands:

Code: Select all

// Steps needed
convert \( -size 2000x2000 xc:white null: \( large.jpg -coalesce \) -gravity Center -layers Composite alphaL.png -compose copy_opacity -gravity Center -composite \) large_cut.png

convert \( -size 2000x2000 xc:white null: \( medium.jpg -coalesce \) -gravity Center -layers Composite alphaM.png -compose copy_opacity -gravity Center -resize 79.72% -composite \) medium_cut.png

convert \( -size 2000x2000 xc:white null: \( small.jpg -coalesce \) -gravity Center -layers Composite alphaS.png -compose copy_opacity -gravity Center -resize 64.12% -composite \) small_cut.png

convert -size 2000x2000 xc:white null: \( large_cut.png -coalesce \) -gravity center -layers Composite -layers Optimize null: \( medium_cut.png -coalesce \) -gravity center -layers Composite -layers Optimize null: \( small_cut.png  -coalesce \) -gravity center -layers Composite -layers Optimize final.png
Concatenated Commands:

Code: Select all

convert \
\( -size 2000x2000 xc:white null: \( large.jpg -coalesce \) -gravity Center -layers Composite alphaL.png -compose copy_opacity -gravity Center -composite \) \
\( -size 2000x2000 xc:white null: \( medium.jpg -coalesce \) -gravity Center -layers Composite alphaM.png -compose copy_opacity -gravity Center -resize 79.72% -composite \) \
\( -size 2000x2000 xc:white null: \( small.jpg -coalesce \) -gravity Center -layers Composite alphaS.png -compose copy_opacity -gravity Center -resize 64.12% -composite \) \
-size 2000x2000 xc:white null: \( -clone 0 -coalesce \) -gravity center -layers Composite -layers Optimize null: \( -clone 1 -coalesce \) -gravity center -layers Composite -layers Optimize null: \( -clone 2 -coalesce \) -gravity center -layers Composite -layers Optimize -composite final.png

Re: Command combination conflict, why?

Posted: 2016-02-19T16:15:45-07:00
by GeeMack
weblife wrote:I get all kinds of alpha issue with the layers after i combine four commands. Ran individually they output correctly but when combined I get the issue at hand.
Without running tests, and just from looking over the commands, I'd suspect your "-compose" operators are causing the problem. If you reset them with "+compose" after you apply each "-composite", you'll return to the default compose method. As it is you're carrying the "-compose copy_opacity" into each next part of the combined command, where with the individual commands, you're starting with a default "-compose" setting.

Re: Command combination conflict, why?

Posted: 2016-02-21T11:39:44-07:00
by sergpush
weblife, did you fix the issue?

Re: Command combination conflict, why?

Posted: 2016-02-22T11:39:31-07:00
by weblife
@sergpush Apologize for the delay in response, went away for the weekend. Thank you for your rapid response. I gave your suggestion a try and it resolved the alpha transparency issue I was having. The layers still aren't being processed correctly, but at least one problem solved.

Re: Command combination conflict, why? [SOLVED]

Posted: 2016-02-22T17:46:23-07:00
by weblife
It came down to the order of operations along with a few other things but in the end this command worked:

Code: Select all

convert \
\( xc:white[2000x2000\!] \) \
\( -clone 0 null: \( large.jpg -coalesce \) -gravity Center -layers Composite -layers Optimize \) \
\( -clone 0 null: \( medium.jpg -coalesce \) -gravity Center -layers Composite -layers Optimize \) \
\( -clone 0 null: \( small.jpg -coalesce \) -gravity Center -layers Composite -layers Optimize \) \
\( -clone 1 alphaL.png -compose copy_opacity -gravity Center -composite +compose \) \
\( -clone 2 alphaM.png -compose copy_opacity -gravity Center -resize 79.72% -composite +compose \) \
\( -clone 3 alphaS.png -compose copy_opacity -gravity Center -resize 64.12% -composite +compose \) \
-delete 0-3 \
\( -clone 0-1 -gravity center -compose src-over -composite \) \
\( -clone 3-2 -gravity center -compose src-over -composite \) \
-delete 0-3 final.png