×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

using /flatedecode with a dictionary

using /flatedecode with a dictionary

using /flatedecode with a dictionary

(OP)
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

RE: using /flatedecode with a dictionary

(OP)
alright, I found a solution, the code has to look like this:

%!PS-Adobe-3.0 EPSF-3.0
%%Creator: <muss noch festgelegt werden>
%%Title: _flate_encoded.eps
%%CreationDate: Sun May 01 16:28:28 2005
%%BoundingBox: 0 0 552 552
%%DocumentData: Binary
%%LanguageLevel: 3
%%EndComments
%%BeginProlog
%%EndProlog
%%Page: 1 1
552 552 scale
/Data currentfile
<< /Predictor 11
   /Columns 768
   /Colors 3
   /BitsPerComponent 8
 >> /FlateDecode filter def
/DeviceRGB setcolorspace
{ << /ImageType 1
     /Width 768
     /Height 768
     /ImageMatrix [ 768 0 0 -768 0 768 ]
     /DataSource Data
     /BitsPerComponent 8
     /Decode [0 1 0 1 0 1]
  >> image
  showpage
} exec [deflate compressed (with PNG Sub-Predictor) bitmap]
%%EOF

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close