结合使用ImageMagick中的resize+extend和composite。

huangapple go评论47阅读模式
英文:

Combining resize+extend with composite in ImageMagick

问题

可以将以下两行命令合并为一行吗?

# 将基本图像调整大小为780x780,并将其放置在画布的南侧(1000x1000)
convert base.jpeg -resize 780x780^ -gravity south -extent 1000x1000 resized_base.jpeg

# 将label.png添加到resized_base.jepg的顶部
convert -composite -gravity north resized_base.jpeg label.png final_output.jpeg

谢谢。

英文:

Is it possible to combine the following two lines of commands into one?

# resize the base image to 780x780, and place it at the South of a canvas(1000x1000)
convert base.jpeg \
-resize 780x780^ \
-gravity south \
-extent 1000x1000 \
resized_base.jpeg

# add label.png to the top of resized_base.jepg
convert \
-composite \
-gravity north \
resized_base.jpeg label.png \
final_output.jpeg

Thanks.

答案1

得分: 2

是的,您可以在Imagemagick中组合它们。请尝试以下操作:

convert base.jpeg \
-resize 780x780^ \
-gravity south \
-extent 1000x1000 \
-gravity north \
label.png \
-composite \
final_output.jpeg
英文:

Yes, you can combine them in Imagemagick. Try the following:

convert base.jpeg \
-resize 780x780^ \
-gravity south \
-extent 1000x1000 \
-gravity north \
label.png \
-composite \
final_output.jpeg

huangapple
  • 本文由 发表于 2023年6月6日 10:40:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76411116.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定