Re: Any chance to improve the performace of this "-compose" cmd?
Posted: 2008-06-20T09:35:31-07:00
I am not sure why you are having trouble with Anthony's method. What version of IM are you using? Type the following: identify -version
If your IM is too old, perhaps you do not have -layers. However, if you do, you can do the following:
convert \( -size 475x873 xc:black \) \( cone.png -resize 30x30 \) \
\( -clone 1 -colorize 40% -repage +23+67 \) \
\( -clone 1 -colorize 40% -repage +75+789 \) \
\( -clone 1 -colorize 40% -repage +76+297 \) \
\( -clone 1 -colorize 40% -repage +256+91 \) \
\( -clone 1 -colorize 20% -repage +91+37 \) \
\( -clone 1 -colorize 20% -repage +57+92 \) \
\( -clone 1 -colorize 20% -repage +10+24 \) \
\( -clone 1 -colorize 20% -repage +2+357 \) \
\( -clone 1 -colorize 90% -repage +2+74 \) \
\( -clone 1 -colorize 90% -repage +87+36 \) \
\( -clone 1 -colorize 90% -repage +37+16 \) \
\( -clone 1 -colorize 90% -repage +46+24 \) \
-delete 1 -compose screen -layers flatten canvas_new1.png
Or this should be slightly faster as it does not recreate the -colorization over and over
convert \( -size 475x873 xc:black \) \
\( cone.png -resize 30x30 \) \
\( -clone 1 -colorize 40% \) \
\( -clone 1 -colorize 20% \) \
\( -clone 1 -colorize 90% \) \
\( -clone 2 -repage +23+67 \) \
\( -clone 2 -repage +75+789 \) \
\( -clone 2 -repage +76+297 \) \
\( -clone 2 -repage +256+91 \) \
\( -clone 3 -repage +91+37 \) \
\( -clone 3 -repage +57+92 \) \
\( -clone 3 -repage +10+24 \) \
\( -clone 3 -repage +2+357 \) \
\( -clone 4 -repage +2+74 \) \
\( -clone 4 -repage +87+36 \) \
\( -clone 4 -repage +37+16 \) \
\( -clone 4 -repage +46+24 \) \
-delete 1-4 -compose screen -layers flatten canvas_new2.png
You will have to put in your directory paths as relevant. I checked the above and it works for me.
Note the ending backslashes are Unix line continuation markers and are needed only if you write this as I have on multiple lines. If you are on windows, then you will need to use other line continuation markers and leave off all the backslashes. See http://www.imagemagick.org/Usage/api/#windows
If your IM is too old, perhaps you do not have -layers. However, if you do, you can do the following:
convert \( -size 475x873 xc:black \) \( cone.png -resize 30x30 \) \
\( -clone 1 -colorize 40% -repage +23+67 \) \
\( -clone 1 -colorize 40% -repage +75+789 \) \
\( -clone 1 -colorize 40% -repage +76+297 \) \
\( -clone 1 -colorize 40% -repage +256+91 \) \
\( -clone 1 -colorize 20% -repage +91+37 \) \
\( -clone 1 -colorize 20% -repage +57+92 \) \
\( -clone 1 -colorize 20% -repage +10+24 \) \
\( -clone 1 -colorize 20% -repage +2+357 \) \
\( -clone 1 -colorize 90% -repage +2+74 \) \
\( -clone 1 -colorize 90% -repage +87+36 \) \
\( -clone 1 -colorize 90% -repage +37+16 \) \
\( -clone 1 -colorize 90% -repage +46+24 \) \
-delete 1 -compose screen -layers flatten canvas_new1.png
Or this should be slightly faster as it does not recreate the -colorization over and over
convert \( -size 475x873 xc:black \) \
\( cone.png -resize 30x30 \) \
\( -clone 1 -colorize 40% \) \
\( -clone 1 -colorize 20% \) \
\( -clone 1 -colorize 90% \) \
\( -clone 2 -repage +23+67 \) \
\( -clone 2 -repage +75+789 \) \
\( -clone 2 -repage +76+297 \) \
\( -clone 2 -repage +256+91 \) \
\( -clone 3 -repage +91+37 \) \
\( -clone 3 -repage +57+92 \) \
\( -clone 3 -repage +10+24 \) \
\( -clone 3 -repage +2+357 \) \
\( -clone 4 -repage +2+74 \) \
\( -clone 4 -repage +87+36 \) \
\( -clone 4 -repage +37+16 \) \
\( -clone 4 -repage +46+24 \) \
-delete 1-4 -compose screen -layers flatten canvas_new2.png
You will have to put in your directory paths as relevant. I checked the above and it works for me.
Note the ending backslashes are Unix line continuation markers and are needed only if you write this as I have on multiple lines. If you are on windows, then you will need to use other line continuation markers and leave off all the backslashes. See http://www.imagemagick.org/Usage/api/#windows