Reduce size of an image when it is fusioned with other using ImageMagick from terminal in Linux

和自甴很熟 提交于 2021-01-29 11:45:46

问题


I am having these two pictures, labeled 1.png and 2.png, respectively:

When I run this code from ImageMagick in my Linux terminal:

composite -blend 75 -gravity West  2.png  1.png prueba.png

I get this result:

However, I would like the logo (2.png) to be half or one-third size reduced and placed in the bottom left corner. How can I do it from the terminal?


回答1:


You can do that in ImageMagick by using the convert syntax. It is more flexible than the composite syntax.

convert 1.png \( 2.png -resize 50% \) -gravity southwest -define compose:args=75 -compose blend -composite 1_2.png





回答2:


If you want to move it further left, you can simply chop off some of the left side before compositing using ImageMagick.

convert 1.png \( 2.png -resize 50% -gravity west -chop 20x0 \) -gravity southwest -define compose:args=75 -compose blend -composite 1_2_b.png


Alternately, you can simply trim the excess empty space around the 2.png before blending.

convert 1.png \( 2.png -resize 50% -trim +repage \) -gravity southwest -define compose:args=75 -compose blend -composite 1_2_c.png




来源:https://stackoverflow.com/questions/60946906/reduce-size-of-an-image-when-it-is-fusioned-with-other-using-imagemagick-from-te

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!