简体   繁体   English

使用ghostscript将PDF转换为TIFF,但不将文件写入磁盘

[英]converting PDF to TIFF using ghostscript but not writing file to disk

我知道ghostscript可以将pdf转换为tiff,甚至具有python绑定,但是我想知道是否有一种方法可以避免将生成的tiff写入磁盘( -SOutputFile=/path/to/file.tiff 。我想保留生成的tiff在内存中并将其用作PIL图像。

Basically, no, not using the standard devices. 基本上,不,不使用标准设备。 That's because the strip size of the TIFF file (and potentially other entries in the TIFF header) can't be written until after the compressed bitmap has been created because the sizes aren't known. 这是因为直到创建压缩位图之后,才能写入TIFF文件的条带大小(以及TIFF头中可能还有其他条目),因为该大小未知。 So you need to be able to seek back to the beginning and update the header. 因此,您需要能够追溯到头并更新标头。

Now you could modify the standard TIFF output devices so that they maintain the output in memory, rather than writing to disk, but that's not how they currently work. 现在,您可以修改标准TIFF输出设备,以使它们将输出保留在内存中,而不是写入磁盘,但这不是它们当前的工作方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM