【问题标题】:How to run imagemagick to batch convert only the first page of multiple PDF files to JPEG?如何运行 imagemagick 仅将多个 PDF 文件的第一页批量转换为 JPEG?
【发布时间】:2019-12-17 20:35:21
【问题描述】:

使用这个命令

convert  source.pdf[0]  output.jpeg

我只能将 pdf 文件的第一页转换为 jpeg,但是如何为多个 pdf 文件执行此操作?

【问题讨论】:

  • 一种选择是围绕它编写一个 Bash/PHP/任何脚本,循环遍历源文件并在每个源文件上调用 ImageMagick。
  • 你能举个例子吗?

标签: pdf imagemagick jpeg


【解决方案1】:

在 Linux 环境中,您可以使用 find 对任何已创建的文件运行命令。

find ./ -iname "*.pdf" -exec convert {}[0]  {}.jpeg \;

该示例将查看当前目录中扩展名为 pdf 的每个文件。 并在其上运行convert 命令。

您可以将*.pdf 掩码更改为任何内容。例如,document*.pdf 会找到如下文件:

document1.pdf
document05.pdf
document_new.pdf

输出文件将是:

document1.pdf.jpeg
document05.pdf.jpeg
document_new.pdf.jpeg

希望有帮助

【讨论】:

    猜你喜欢
    • 2012-09-18
    • 2011-06-16
    • 2015-09-05
    • 1970-01-01
    • 2012-04-15
    • 1970-01-01
    • 2013-06-03
    • 2014-06-19
    • 1970-01-01
    相关资源
    最近更新 更多