Xref: utzoo comp.sys.mac:20907 comp.sys.mac.programmer:2561 comp.lang.postscript:1017
Path: utzoo!attcan!uunet!husc6!rutgers!mailrus!ames!lll-tis!hot.ee.lbl.gov!jef
From: jef@hot.ee.lbl.gov (Jef Poskanzer)
Newsgroups: comp.sys.mac,comp.sys.mac.programmer,comp.lang.postscript
Subject: Re: PostScript run-length encoding (again)
Summary: Yes, it's possible.
Message-ID: <1032@hot.ee.lbl.gov>
Date: 28 Sep 88 08:32:08 GMT
References: <271@rna.UUCP>
Reply-To: Jef Poskanzer 
Organization: Paratheo-Anametamystikhood Of Eris Esoteric, Ada Lovelace Cabal
Lines: 45

I just spent a few hours modifying my pbmtops filter to produce run length
encoded PostScript output.  The results are not spectacular for me -- yes,
the files are smaller, but the printing times are about the same.  But I'm
printing over the network.  If you were stuck with the serial line, this
would be a big win.

I've appended a sample program generated by my filter.  If anyone sees
ways to improve the code, please let me know, I'm not much of a PostScript
hacker.  This version of pbmtops will be distributed to comp.sources.misc
and expo.lcs.mit.edu sometime in October.
---
Jef

             Jef Poskanzer   jef@rtsg.ee.lbl.gov   ...well!pokey
                       Prerecorded for this time zone.

- - - - - - - - - -

%! t.ps

/rlestr1 1 string def
/rlestr 128 string def
/readrlestring {
  currentfile rlestr1 readhexstring pop  0 get
  dup 127 le {
    currentfile rlestr 0  4 3 roll  1 add  getinterval
    readhexstring  pop
  } {
    256 exch sub  dup
    currentfile rlestr1 readhexstring pop  0 get
    exch 0 exch 1 exch 1 sub { rlestr exch 2 index put } for
    pop  rlestr exch 0 exch getinterval
  } ifelse
} def

293 393 translate	% move to lower left corner of box
15 15 scale		% scale box

16 16 1			% width height bits/sample
[ 16 0 0 -16 0 16 ]	% transformation matrix
{ readrlestring }	% proc
image
1f000055543ffe7ffc3ffe7ffc3ffe7ffc8003c0018003c0018003c001aa
abffff
showpage