Page 1 of 1

How to reduce number of the commands lines

Posted: 2019-08-17T08:14:06-07:00
by direction
New to imageMacgicK command lines.
Have four commands, want to combine them to one command (or reduce the number as many as possible). The purpose: avoid writing too many output files to disk.
What needed is the maked-final.png file

Code: Select all

convert tmp2.png -background transparent -extent 600x600 mask1.png -composite masked-up.png
composite -compose Dst_Over -geometry +0+350 tmp3.png mask2.png masked-bottom.png
convert masked-bottom.png -fuzz 10% -transparent black masked-bottom-trans.png
convert masked-up.png masked-bottom-trans.png -composite mask3.png -composite masked-final.png

Re: How to reduce number of the commands lines

Posted: 2019-08-17T09:55:52-07:00
by direction
The key may be:
How to change the 2nd line: composite command to convert command

Re: How to reduce number of the commands lines

Posted: 2019-08-17T10:10:38-07:00
by direction
direction wrote: 2019-08-17T08:14:06-07:00 New to imageMacgicK command lines.
Have four commands, want to combine them to one command (or reduce the number as many as possible). The purpose: avoid writing too many output files to disk.
What needed is the maked-final.png file

Code: Select all

convert tmp2.png -background transparent -extent 600x600 mask1.png -composite masked-up.png
composite -compose Dst_Over -geometry +0+350 tmp3.png mask2.png masked-bottom.png
convert masked-bottom.png -fuzz 10% -transparent black masked-bottom-trans.png
convert masked-up.png masked-bottom-trans.png -composite mask3.png -composite masked-final.png
I have reduced to 2 lines, but not sure how to do it further.

Code: Select all

convert mask3.png tmp3.png -compose Dst_Over -geometry +0+350 -composite -fuzz 10% \
	-transparent black masked-bottom-trans.png
convert tmp2.png -background transparent -extent 600x600 mask1.png -composite \
	masked-bottom-trans.png -composite mask3.png -composite masked-final.png

Re: How to reduce number of the commands lines

Posted: 2019-08-17T10:33:08-07:00
by fmw42
See parenthesis processing https://imagemagick.org/Usage/basics/#parenthesis

Code: Select all

convert tmp2.png -background transparent -extent 600x600 mask1.png -composite \
\( mask3.png tmp3.png -geometry +0+350 -compose Dst_Over -composite \
-fuzz 10% -transparent black \) -composite mask3.png \
-composite masked-final.png