havingnoidea
Programmer
Hi all,
My original idea was to embed a bitmap image into an eps file. Because bitmaps in general are quite large I decided to compress it. First I thought i could simply generate a png image and embed it into an eps but then I found out that it is not possible for Postscript interpreters to decode png files directly. So I compressed the bitmap directly with the deflate algorithm (same as used in png) and used the FlateDecode filter to decode the image.
The following code is an example I wrote. The code is partly taken form an example that shows how to use the DCTDecode filter. I changed it to FlateDecode and it works this way.
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: <not yet specified>
%%Title: flate_encoded.eps
%%CreationDate: Tue Apr 26 16:13:50 2005
%%BoundingBox: 0 0 548 534
%%DocumentData: Binary
%%LanguageLevel: 3
%%EndComments
%%BeginProlog
%%EndProlog
%%Page: 1 1
548 534 scale
/Data currentfile /FlateDecode filter def
/DeviceRGB setcolorspace
{ << /ImageType 1
/Width 762
/Height 743
/ImageMatrix [ 762 0 0 -743 0 743 ]
/DataSource Data
/BitsPerComponent 8
/Decode [0 1 0 1 0 1]
>> image
showpage
} exec [ deflate compressed bitmap ]
%%EOF
In the "Postscript Language Reference Manual 3rd Edition" (page 141) I discovered that Postscript supports so called PNG predictor functions which would make the compression more effective. My question now is: How do I have to change the above code so that i'm able to use the PNG predictors to decode the image? I know that I have to specify a dictionary as input for the FlateDecode filter but I'm relatively new to postscript. Any ideas how to do this?
thanks for your help
My original idea was to embed a bitmap image into an eps file. Because bitmaps in general are quite large I decided to compress it. First I thought i could simply generate a png image and embed it into an eps but then I found out that it is not possible for Postscript interpreters to decode png files directly. So I compressed the bitmap directly with the deflate algorithm (same as used in png) and used the FlateDecode filter to decode the image.
The following code is an example I wrote. The code is partly taken form an example that shows how to use the DCTDecode filter. I changed it to FlateDecode and it works this way.
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: <not yet specified>
%%Title: flate_encoded.eps
%%CreationDate: Tue Apr 26 16:13:50 2005
%%BoundingBox: 0 0 548 534
%%DocumentData: Binary
%%LanguageLevel: 3
%%EndComments
%%BeginProlog
%%EndProlog
%%Page: 1 1
548 534 scale
/Data currentfile /FlateDecode filter def
/DeviceRGB setcolorspace
{ << /ImageType 1
/Width 762
/Height 743
/ImageMatrix [ 762 0 0 -743 0 743 ]
/DataSource Data
/BitsPerComponent 8
/Decode [0 1 0 1 0 1]
>> image
showpage
} exec [ deflate compressed bitmap ]
%%EOF
In the "Postscript Language Reference Manual 3rd Edition" (page 141) I discovered that Postscript supports so called PNG predictor functions which would make the compression more effective. My question now is: How do I have to change the above code so that i'm able to use the PNG predictors to decode the image? I know that I have to specify a dictionary as input for the FlateDecode filter but I'm relatively new to postscript. Any ideas how to do this?
thanks for your help