[Status] [Installation] [Usage] [Known bugs] [Versions] [Copyright] [Download]
[see below for a comment on the status of this code.]
The xv-psnewstyle patch provides a different Postscript output format, which is more compact and is rendered faster on most printers. An option in the Postscript save dialogue allows a standard xv Postscript file to be output to allow comparison of the two formats.
The xv-psnewstyle Postscript output uses the Lempel-Ziv Welch (LZW) compression algorithm for image encoding in Postscript. This produces very compact files: usually several times smaller than files produced with Run Length Encoding (which is used in xv's standard compressed Postscript output) and very much smaller than files produced without compression.
Unlike the standard xv, xv-psnewstyle also allows compression of 24-bit images, though LZW compression may not be effective on 24-bit colour photographic images - in which case a slightly larger file could even be produced (in this case, compression need not be enabled in the Postscript save dialogue).
Additional compression is obtained by using an 85-letter character encoding
u), rather than hexadecimal.
This gives a size reduction of a factor
1.6 (excluding header information).
% characters in the first
indented by one character to prevent programs that strip Postscript comments
(eg. dvips without the
-K0 option) from removing these lines.
Postscript files produced by xv-psnewstyle automatically understand on what kind of printer they are being printed. On Level 2 Postscript printers the native LZW/ASCII85 decoding filters will be invoked, while on Level 1 printers inline decompression code is executed. Rendering time on Level 2 printers is pretty fast. On Level 1 printers the image rendering is, of course, much slower, but still usually faster than for Run Length Encoded Postscript images.
The xv-psnewstyle patch was written by Tim Adye <T.J.Adye@rl.ac.uk>, using C and Postscript code based originally on the Postscript generation code in xwpick 2.21 by Evgeni Chernyaev <firstname.lastname@example.org> (xwpick used to be called xpick). Some of this code was also used in the gifconv program. I have modified the xwpick C and Postscript code extensively, so any bugs therein are almost certainly my fault.
This patch still has a few sharp edges (see below), could do with a lot of tidying up, checking, and more careful comparison with standard xv (there are a few features of the standard xv's Postscript output that should also be available in the xv-psnewstyle). But it basically works for what I want it to do, so I've decided to pause at this point and make it available in case anyone else finds it useful.
If there is much interest, I'll try to do a better job of tidying it up and making it more generally applicable. I also have a few ideas on further improvements. So, if you think this might be of interest to you, let me know (email T.J.Adye@rl.ac.uk).
All required files are included in this patch
file. Copy the patch file into
xv-3.10a/ source directory and run
Then recompile with
patch < xv-psnewstyle.patch
xv-3.10a patched with xv-psnewstyle looks very similar to the standard xv.
In the Postscript save dialogue, there is a new checkbox
new style". When
selected (the default), xv-psnewstyle is used. When deselected, the standard
xv Postscript output is used (in this case,
compress" option will
become inactive for 24-bit images, since
standard xv does not support compressed 24-bit images).
new style" enabled, the "
enables and disables LZW compression. ASCI85 encoding is used in both cases.
cc -std1 -Olimit 750, as recommended by the
Makefile) seems to work fine.
psencode. First version for xv-psnewstyle. Added
noLZWoption. Added 24-bit direct colour and direct grayscale output.
The LZW encoding routines were written in 1993/4 by Evgeni Chernyaev as part of Xwpick. Since then Unisys have asserted a patent on the LZW algorithm. Use of xv-psnewstyle may be constrained by this patent.
xv-psnewstyle is Copyright 1994, 1996, 1998, 1999 by Tim Adye <T.J.Adye@rl.ac.uk>. The following copyright restrictions and disclaimer apply also to the xv-psnewstyle code.
Xwpick is Copyright 1993, 1994 by Evgeni Chernyaev
Permission to use, copy, modify, and distribute this software and its documentation for non-commercial purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both the copyright notice and this permission notice appear in supporting documentation.
This software is provided "as is" without express or implied warranty.
The xwpick author may be contacted via:
- Evgeni Chernyaev
Institute for High Energy Physics
142284 Protvino, Moscow region