Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从PostScript中提取位图_Php_Imagemagick_Ghostscript_Postscript - Fatal编程技术网

Php 从PostScript中提取位图

Php 从PostScript中提取位图,php,imagemagick,ghostscript,postscript,Php,Imagemagick,Ghostscript,Postscript,我需要从PostScript文件(.ppf)中提取位图。它用RLE压缩,用ASCIIHexEncode编码。我将从PHP调用它。我想知道是否有一个优雅的方式来做到这一点。我不想重新发明轮子,但我想使用现有的库。有没有办法从PostScript、Ghostscript或imagick调用压缩过滤器 您可以编写PostScript程序来对输入运行压缩/解压缩过滤器。因此,如果位图数据已提取到一个名为myfile.rle.hex的文件中,则可以将其放入一个名为decode.ps的文件中: 然后是“gs

我需要从PostScript文件(.ppf)中提取位图。它用RLE压缩,用ASCIIHexEncode编码。我将从PHP调用它。我想知道是否有一个优雅的方式来做到这一点。我不想重新发明轮子,但我想使用现有的库。有没有办法从PostScript、Ghostscript或imagick调用压缩过滤器

您可以编写PostScript程序来对输入运行压缩/解压缩过滤器。因此,如果位图数据已提取到一个名为myfile.rle.hex的文件中,则可以将其放入一个名为decode.ps的文件中:

然后是“gs decode.ps”。还有其他方法可以实现这一点,您可以使用-c将全部内容放在Ghostscript命令行上,您可以使用-c在命令行上定义文件名,然后运行decode.ps,但将(/home/ken/myfile.hex.rle)替换为您在命令行上定义的文件名。您可以使用其他筛选器在原始PostScript中查找数据


但是,如果您不了解更多关于输入和输出工作原理的信息,我就无法真正提出任何建议。

谢谢您的示例。对这就是我想走的路。我一点也不知道postscript,但我会尝试使用从php调用的ghostscript玩一点。这应该行得通。
/InFile (/home/ken/myfile.rle.hex) (r) file /ASCIIHexDecode filter 
/RLEDecode filter 
def
/OutFile (/home/ken/myfile.raw) (w) file def
/Data 32768 string def

{
    InFile Data readstring {
    OutFile exch writestring
    } {
    OutFile exch writestring
    exit
    } ifelse
} loop

InFile closefile
OutFile closefile