ImageMagick:水印图像并保留文件名 [英] ImageMagick: Watermark image and keep file name

查看:349
本文介绍了ImageMagick:水印图像并保留文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这段代码,但我想编辑它,以便导出的文件名与用于制作它的文件名相同

I have this code but I would like to edit it so the exported file name is the same as the file name used to make it

mogrify -composite -gravity center ~/Desktop/civmap-client-master/data/watermark.png ~/Desktop/civmap-client-master/data/nowm/*.png ~/Desktop/civmap-client-master/data/wm/*.png

当我使用* .png时,它只会抛出一个错误我导出的文件名。请注意我在/ nowm /目录中有多个文件。我正在使用Mac。

It just throws an error when I used *.png as my exported file name. Please note I have multiple files in the /nowm/ directory. I am using a Mac.

非常感谢:)

推荐答案

mogrify 命令不接受 -composite 作为操作,因为它只需要2张图像。你将不得不使用循环:

The mogrify command does not accept -composite as an operation as it takes just 2 images. You will have to use a loop:

cd ~/Desktop/where/the/input/images/are
for f in *.png; do 
  echo $f
  convert -gravity center "$f" "~/Desktop/path/to/watermark.png" -composite "~/Desktop/path/to/output/$f"
done

这篇关于ImageMagick:水印图像并保留文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆