Ghostscript输出保存位置

1 投票
1 回答
2214 浏览
提问于 2025-04-17 20:08

我想在Python中使用Ghostscript。这是我的代码:

import sys
import ghostscript

args = [
    "-sDEVICE=jpeg",
    "-sOutputFile=test-%d.jpg",
    "-dBATCH", "-dNOPAUSE",
    "/users/arnoutaertgeerts/downloads/langetest.pdf"
    ]

ghostscript.Ghostscript(*args)

但是我找不到生成的图片(虽然我能看到它们正在生成!)我做了一些测试,似乎在-sDEVICE后面输入什么都没关系。所以可能哪里出了问题?我使用的是Ghostscript 9.0.6

Ghostscript把我的图片保存在哪里呢?

1 个回答

1

因为你的参数里没有 -dSAFER,所以你应该可以指定完整的路径,包括一个带有目录的完整路径(就像你对输入文件那样)。试试这个:-sOutputFile="/users/arnoutaertgeerts/test-%d.jpg"

然后去你的 /users/arnoutaertgeerts 目录看看。

撰写回答