【问题标题】:ImageMagick bash script issueImageMagick bash脚本问题
【发布时间】:2010-05-14 12:35:24
【问题描述】:
// This works
convert ${path}${dst} -crop ${crop} ${path}${dst}

// but when changed to this, it fails
convert ${path}${src} -trim ${path}${dst}
convert ${path}${dst} -crop ${crop} ${path}"pdf_"${dst}

我做错了什么?

【问题讨论】:

  • 这有点神秘 - 它是如何失败的?

标签: php linux bash scripting imagemagick


【解决方案1】:

改变这个:

convert ${path}${dst} -crop ${crop} ${path}"pdf_"${dst}

到这里:

convert ${path}${dst} -crop ${crop} "${path}pdf_${dst}"

帮助?

【讨论】:

  • 在 Bash 中,除非$path$dst 中有空格,否则这不会有任何区别。
【解决方案2】:

对我来说很好。

$ path=./
$ src=test.jpg
$ dst=test2.jpg
$ crop=100x100+10+10
$ convert ${path}${src} -trim ${path}${dst}
$ convert ${path}${dst} -crop ${crop} ${path}pdf_${dst}
$ identify pdf_test2.jpg
pdf_test2.jpg JPEG 100x100 100x100+0+0 DirectClass 8-bit 3.30078kb

【讨论】: