 2009/07/04
|
Last update 2001/10/04
 The Labs - Design & Functionality For The Net
- GhostScript
- PostScript to Raster
- Fonts
- Tools
- Resources
- Bibliography
IHMO PostScript wouldn't be that alive if GhostScript
hadn't been written and shared publically. Download it and study its
setup files (ps-source-files), and also most of the comprehensive .txt files
enclosed in the distribution, they reveal profound PS knowledge.
| PostScript2. PostScript to Raster
|
The easiest solution is using GhostScript:
|
gs -sDEVICE=ppmraw -q -r300 -dNOPAUSE -sOutputFile=output.ppm sample.ps
|
Best you use netpbm (aka pbmplus), a toolset to handle pnm (ppm, pgm and pbm).
Use ftpsearch to locate a copy of it,
or FreeBSD there is a port in /usr/ports/graphics/netpbm/.
You can also use PicArt to handle pnm-files.
GhostScript-3.33 and later provide many DEVICES. I usually use gs within
perl to render PostScript, choose a high -r of 200 or 300 to have a good quality, too high
resolution as 600 or higher create huge ppm files. PPM format is
recommended as it's lossless true 24 bit color (RGB) and pretty simple format,
otherwise PNG or TIFF are 24 bit lossless but compressed. Call
GhostScript can be used to render Type 1 & Type 3 Fonts, but I would recommend
nowadays to use the T1LIB.
You require to write your own routines to write the picture though.
A simple Text to GIF rendering using perl:
|
# assuming $font, $points, $dpi and $s are defined
|
|
|
|
$s =~ s/\(/\\(/g;
|
|
$s =~ s/\)/\\)/g;
|
|
open(F,">my.ps");
|
|
print F "/$font findfont $points scalefont setfont\n";
|
|
print F "($s) show showpage quit\n";
|
|
close(F);
|
|
`gs -sDEVICE=ppmraw -q -r$dpi -dNOPAUSE -sOutputFile=- my.ps |\
|
|
pnmcrop | ppmquant 128 | ppmtogif > output.gif`;
|
A cheap anti-aliasing you get by using pnmscale it with -xscale .5 and -yscale .5.
Links with require password to access
them as they contain copyrighted material on our server and are only available for
our customers.
| PostScript6. Bibliography
|
PostScript Language Reference Manual, First Edition, Adobe Systems Inc.
PostScript Language Tutorial and Cookbook, First Edition, Adobe Systems Inc.
PostScript Language Reference Manual, Second Edition, Adobe Systems Inc.

Hipocrisy of the finest: "I agree that no single company can create all the hardware and software. Openness is central because it's the foundation of choice." -- Steve Balmer (Microsoft) blaming Apple regarding iPhone, February 18, 2009Last update 2001/10/04 
All Rights Reserved - (C) 1997 - 2009 by The Labs.Com |