ImageMagick - 为许多照片添加白色边框,其尺寸相对于宽度和高度(例如:宽度 * 1.34%)
是否可以编写一个脚本,可以创建文件中所有图片的副本,并为其添加白色边框,边框乘以一定的百分比?
我希望新图像(旧图像+边框)的宽度约为旧图像的 134%,高度约为旧图像的 165%。
我想这相当简单,但并不积极,到目前为止我的所有尝试都没有成功。
到目前为止,我当前的代码是:
'''for i in ls; do name = "mat_$i" echo "正在处理 $name..." ;转换 $i -bordercolor 白色 -border 1x2 $name;完成''''
1x2 肯定是关闭的,但我在那里尝试过的任何方法都不起作用。
我还想添加元数据,因为其中一些图片是专业的,并且可能在线分发。提前致谢。
Is it possible to write a script that can create a copy of all the pictures in a file and add a white border to it with the border multiplied by a certain percentage?
I want the width of the new image (old image + border) to be about 134% of the old one and height about 165% of the old one.
I imagine this is fairly simple but not positive how and all my attempts so far have been unsuccessful.
My current code so far is:
'''for i in ls; do name = "mat_$i" echo "processing $name..." ; convert $i -bordercolor white -border 1x2 $name; done''''
The 1x2 is off for sure, but nothing I have tried there worked either.
I would also like to add meta data as some of these pics are professional and maybe distributed online. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 Imagemagick 6 的一种方法。
输入:
结果:
对于 Imagemagick 7,您可以按如下方式内联执行此操作:
Here is one way for Imagemagick 6.
Input:
Result:
For Imagemagick 7, you can do that inline as follows: