🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #1375

Re: PostScript beginner needs help with "image" command

#1375
From: Henry McGilton -- Software Produ...
Date: Sun, 26 Nov 1989 23:08
50 lines
2645 bytes
In article <9790@saturn.ucsc.edu>, humtech@ucschu.ucsc.edu (Mark Frost) writes:

    *  Hello. I'm very new to postscript. I've been trying to
    *  get a 512x512 pixel bitmap to print on our LaserWriter
    *  IINT. For some reason or another, I can only get
    *  256x256 images to print. When I do a 512x512 all I
    *  manage to get is a blank page. I tried a 256x512 once
    *  and got a few pixels on either side of the page, but
    *  the center of the image was blank. I've tried this with
    *  8 bit per sample (the way I get the data from another
    *  machine) and 4 bits per sample. I'm currently trying to
    *  scale it down to 1 bit per sample in hopes that this will help.

    *  The basic code that I'm using is

	    %!PS-Adobe-1.0
	    100 400 translate
	    200 200 scale

	    512 512 4 [512 0 0 -512 0 512]
	    {<
	    ...OODLES of hex bytes go here...
	    >} image
	    showpage

The basic problem with this approach is that the 

	    {< . . . >}

code sequence is placing a hexadecimal string on the stack.
Strings are limited in length to 65535 bytes (documented on
page 260 of my Red Book).  When you have a 256 x 256 x 4
bit image, this translates into 32768 bytes of data, and
when you double that (two hex characters per byte) you have
a string of 65536 bytes (one too many, which will probably
go unnoticed.  But, when you have a 512 x 512 x 4 bit image,
this translates into 262144 bytes of image data, which is 
four times the allowable length of a string.

You are much better off doing it the open ended way by
using  readhexstring  to get the bytes from the current
file.  Take a look at the turkey example on page 149 of the
Blue Book for a starting point.

	............. Henry
+------------------+------------------------+---------------------------+
| Henry McGilton   | I saw the future,      | arpa: hmcgilton@sun.com   |
| Sun Microsystems | and it didn't work.    | uucp: ...!sun!angel!henry |
| Mt. View, CA     |                        |                           |
+------------------+------------------------+---------------------------+
Technical Details
Message-ID: <128392@sun.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!sun-barr!newstop!sun!angel!henry
References: <9790@saturn.ucsc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!sun-barr!newstop!sun!angel!henry
From: henry%angel@Sun.COM (Henry McGilton -- Software Products)
Newsgroups: comp.lang.postscript
Subject: Re: PostScript beginner needs help with "image" command
Summary: Limits On String Length
Keywords: image bitmap postscript
Message-ID: <128392@sun.Eng.Sun.COM>
Date: 26 Nov 89 23:08:14 GMT
References: <9790@saturn.ucsc.edu>
Sender: news@sun.Eng.Sun.COM
Distribution: na
Lines: 50