Easy way to add image in postscript

I am trying to write a document in postscript.

Until now, I could write plain text and work with lines and shapes.

Now I am trying to add some images to the document. After searching online, I didn't seem to find a clear way to do this.

The picture below is a welcome world:

%!PS /Times 20 selectfont 20 800 moveto (Hello World!) show showpage 

All I want to do is simply insert an image (e.g. PNG, JPG, GIF), specifying the x and y coordinates.

Any help would be greatly appreciated.

+7
source share
3 answers

There is a simple method, and Postscript supports the jpeg format. If you are using ghostscript, you may have to use the -dNOSAFER option to open files. Here is an example:

 gsave 360 72 translate % set lower left of image at (360, 72) 175 47 scale % size of rendered image is 175 points by 47 points 500 % number of columns per row 133 % number of rows 8 % bits per color channel (1, 2, 4, or 8) [500 0 0 -133 0 133] % transform array... maps unit square to pixel (myJPEG500x133.jpg) (r) file /DCTDecode filter % opens the file and filters the image data false % pull channels from separate sources 3 % 3 color channels (RGB) colorimage grestore 
+10
source

You can download the link to PostScript Language, the third edition from adobe (this is a "Bible book" for the postscript). Chapter 4.10. Images will be a good starting point.

+2
source

Use a program like convert , and then remove any added code.

+2
source

All Articles