我编写了一个C代码来从PWG光栅文件生成postscript文件。输出正在工作(格式是颜色模型-位深度):黑色-1,黑色-8,黑色-16,rgb-8,rgb-16,灰色-1,灰色-8,灰色-16,srgb-8,srgb-16,adobergb-8,sgray-1,sgray-8,cmyk-1,cmyk-8,cmyk-16。但是所给出的adobergb-16和sgray-16的输出是错误的。我得到的模式类似于输入文件,但颜色都是像素化的。
实际代码非常大,所以我发布了我所做的事情:
take all the image pixels in an unsigned char* variable (this sometimes becomes very large)
encode the pixels using deflate algorithm from zlib
display the result对于adobergb-16,我将PS颜色空间设置为/DeviceRGB,解码数组为/Decode [0 1 0 1 0 1]。对于sgray-16,我将PS颜色空间设置为/DeviceGray,解码为/Decode [0 1],这些设置类似于adobergb-8和sgray-8。
编辑1:添加用于测试这里的示例文件
如果您需要任何进一步的信息或代码片段,请随时询问。
发布于 2016-06-20 07:56:34
您已经设置了"/BitsPerComponent 16";正如我前面所说的,这不是一个合法值,因为PostScript只支持每个组件1、2、4、8和12位。
通过运行此文件提供:
误差%%:范围检查;OffendingCommand: imageDistiller;ErrorInfo: BitsPerComponent 16 %
像这样重写你的图像:
gsave
/DeviceRGB setcolorspace
/Input currentfile /FlateDecode filter def
4958 7017 scale
<<
/ImageType 1
/Width 4958
/Height 7017
/BitsPerComponent 8
/Decode [0 1 0 1 0 1]
/DataSource {3 string 0 1 2 {1 index exch Input read {pop}if Input read pop put } for} bind
/ImageMatrix [4958 0 0 -7017 0 7017]
>> image将BitsPerComponent设置为8,丢弃每16位值的最高字节,输出按预期工作。
当我说‘一个很好的简单的小例子’时,我并不是指30 MB的数据,这不是展示问题的必要条件,我确信。当发布示例时,可以创建一个简单、小的示例,并使用它。我没费心下载你的其他文件。
重申;您不能设置/BitsPerComponent 16,PostScript不支持每个组件16位。
https://stackoverflow.com/questions/37904058
复制相似问题