ImageMagick: Center-Gravity Composite Layered Images

enter image description here

background

http://i.stack.imgur.com/wA2EL.png

overlay

composite -gravity center overlay.png background.jpg result1.jpg 

http://i.stack.imgur.com/XgdA2.jpg

result1.jpg

 convert -composite background.jpg overlay.png -gravity center result2.jpg 

result2.jpg

 convert -composite background.jpg -gravity center tool_marker.png result3.jpg 

result3.jpg

How can I achieve results from result1 when using convert as executable rather than composite?

Thanks!

+6
source share
1 answer

You can start by using the operators in the correct order. The "settings" are set first. The "Composite" command is to "read all the settings, and then apply the ONE operation, the command type (traditional UNIX)" Convert "is to" make options as you see them, "while MULTIFUNCTIONAL operations are possible. (Script-like command)

 convert background.jpg tool_marker.png -geometry +50+50 -composite result4.jpg 

Note that + 50 + 50 is the location of the upper left corner of the image "tool_marker.png". You will need to subtract the pin-point location on this image to get it at the correct location.

The gravity center (if set before using the -composition operation that uses it) aligns the center of the BOTH images.

 convert background.jpg tool_marker.png -gravity center -composite result4.jpg 
+11
source

Source: https://habr.com/ru/post/907013/


All Articles