Devices.htm 81.2 KB
Newer Older
1
<!doctype html>
2 3
<html>
<head>
4 5 6 7 8 9 10 11
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-54391264-2"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-54391264-2');
12
</script>
13 14 15
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
16
<link rel="shortcut icon" type="image/png" href="../../images/favicon.png">
17
<title>Details of Ghostscript Output Devices</title>
18
    <!-- Originally: devices.txt -->
19 20
<link href="style.css" rel="stylesheet" type="text/css">
<link href="gs-style.css" rel="stylesheet" type="text/css">
21 22 23
</head>

<body>
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

    <div class="header">
    <div class="row">
        <div class="col-lt-6 logo"><a href="https://www.ghostscript.com/"><img src="images/ghostscript_logo.png" width="108" height="119" alt=""></a></div>
        <div class="col-6"><div class="row"><div class="artifexlogo"><a href="https://artifex.com" target="_blank"><img src="images/Artifex_logo.png" width="194" height="40" alt=""></a></div>
        <div class="col-12"><div class="button button1"><a href="https://artifex.com/contact-us/" title="Contact Us" target="_blank">Contact Us</a></div>
        <div class="button button2 hidden-xs"><a href="https://www.ghostscript.com/download.html" title="Download">Download</a></div></div></div>
    </div>
    </div>
    </div>

    <div class="banner">
    <div class="row">
        <div class="col-12">Details of Ghostscript Output Devices</div>
    </div>
    </div>

    <div class="main">
    <div class="row">
    <div id="sidebar">
    <div class="sidebar-item"></div>
    <div class="col-2 leftnav">
46
<ul>
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
            <li><a href="https://www.ghostscript.com/">Home</a></li>
            <li><a href="https://www.ghostscript.com/license.html">Licensing</a></li>
            <li><a href="https://www.ghostscript.com/releases.html">Releases</a></li>
            <li><a href="https://www.ghostscript.com/release_history.html">Release History</a></li>
            <li><a href="https://www.ghostscript.com/documentation.html" title="Documentation">Documentation</a></li>
            <li><a href="https://www.ghostscript.com/download.html" title="Download">Download</a></li>
            <li><a href="https://www.ghostscript.com/performance.html" title="Performance">Performance</a></li>
            <li><a href="http://jbig2dec.com/" title="jbig2dec">jbig2dec</a></li>
            <li><a href="http://git.ghostscript.com/?p=ghostpdl.git;a=summary">Source</a></li>
            <li><a href="http://bugs.ghostscript.com/">Bugs</a></li>
            <li><a href="https://www.ghostscript.com/faq.html" title="FAQ">FAQ</a></li>
        </ul>
    </div>
    </div>
    <div class="col-10 page">

63 64
<!--START EDITING HERE-->

65 66 67 68 69 70 71
<!-- [1.0 begin visible header] ============================================ -->

<!-- [1.1 begin headline] ================================================== -->

<h2>Table of contents</h2>

<blockquote><ul>
72 73
<li><a href="#Measurements">Notes on measurements</a></li>
<li><a href="#File_formats">Image file formats</a></li>
74
<ul>
75 76 77 78 79 80 81 82
<li><a href="#PNG">PNG file format</a></li>
<li><a href="#JFIF">JPEG file format (JFIF)</a></li>
<li><a href="#PNM">PNM file format</a></li>
<li><a href="#TIFF">TIFF file formats</a></li>
<li><a href="#fax">fax file formats</a></li>
<li><a href="#BMP">BMP file format</a></li>
<li><a href="#PCX">PCX file format</a></li>
<li><a href="#PSD">PSD file format (DeviceN color model)</a></li>
83
</ul>
84
<li><a href="#High-level">High level formats</a></li>
85
<ul>
86 87 88 89 90 91
<li><a href="#PDF">PDF file output</a></li>
<li><a href="#PDFimage">Bitmap PDF output, PCLm output</a></li>
<li><a href="#PS">PostScript file output</a></li>
<li><a href="#EPS">EPS file output</a></li>
<li><a href="#PXL">PCL-XL file output</a></li>
<li><a href="#TXT">Text output</a></li>
92
</ul>
93
<li><a href="#Dis    play_devices">Display devices</a></li>
94
<ul>
95 96
<li><a href="#x11_devices">X Window System</a></li>
<li><a href="#display_device">display device (MS Windows, OS/2, gtk+)</a></li>
97
</ul>
98 99 100 101 102 103
<li><a href="#IJS">IJS - Inkjet and other raster devices</a></li>
<li><a href="#Rinkj">Rinkj - Resplendent inkjet driver</a></li>
<li><a href="#HP_ijs">HP Deskjet official drivers</a></li>
<li><a href="#gimp-print">Gimp-Print driver collection</a></li>
<li><a href="#Win">MS Windows printers</a></li>
<li><a href="#SPARCprinter">Sun SPARCprinter</a></li>
104
<ul>
105 106
<li><a href="#SPARC_install">Installation</a></li>
<li><a href="#SPARC_problems">Problems</a></li>
107
</ul>
108
<li><a href="#Apple">Apple dot matrix printer</a></li>
109
<li><a href="#Test">Special and Test devices</a></li>
110
<ul>
111 112 113
<li><a href="#Bit">Raw 'bit' output.</a></li>
<li><a href="#Bounding_box_output">Bounding Box output.</a></li>
<li><a href="#Ink_coverage_output">Ink coverage output.</a></li>
114 115 116 117
<li><a href="#Permute">Permutation (DeviceN color model)</a></li>
<li><a href="#SPOT">spotcmyk (DeviceN color model)</a></li>
<li><a href="#XCF">XCF (DeviceN color model)</a></li>
<li><a href="#bitraw">Raw 'bit' devices</a></li>
118 119 120 121 122 123 124 125 126 127
</ul>
</ul></blockquote>

<!-- [1.2 end table of contents] =========================================== -->

<!-- [1.3 begin hint] ====================================================== -->

<p>For other information, see the <a href="Readme.htm">Ghostscript
overview</a>.  You may also be interested in <a href="Make.htm">how to
build Ghostscript</a> and <a href="Install.htm">install it</a>, as well as
128
the description of the <a href="Drivers.htm">driver interface</a>.</p>
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147

<p>Documentation for some older, superceded devices has been moved to
<a href="Deprecated.htm">another document</a>. In general such devices are deprecated
and will be removed in future versions of Ghostscript. In general all older printer
drivers can be replaced by the ijs interface and one of the available 3rd party raster
driver collections. We recommend moving to the ijs device for all such printing.</p>

<!-- [1.3 end hint] ======================================================== -->

<hr>

<!-- [1.0 end visible header] ============================================== -->

<!-- [2.0 begin contents] ================================================== -->

<h2><a name="Measurements"></a>Notes on measurements</h2>

<p>
Several different important kinds of measures appear throughout this
148
document: inches, centimeters and millimeters, points, and bits per pixel.</p>
149 150 151 152 153 154 155 156 157 158 159 160

<dl>

<dt>Centimeters and millimeters</dt>
<dd>ISO standard paper sizes such as A4 and A3 are commonly represented in
the SI units of centimeters and millimeters.  Centimeters are abbreviated
<dfn><abbr>cm</abbr></dfn>, millimeters <dfn><abbr>mm</abbr></dfn>.  ISO A4 paper is
quite close to 210&times;297 millimeters (approximately 8.3&times;11.7
inches).</dd>

<dt>Inches</dt>
<dd>1 inch equals 2.54 centimeters.  The inch measure is sometimes
161
represented by <dfn><abbr>in</abbr></dfn> or a quotation mark
162
(<abbr>&quot;</abbr>) to the right
163
of a measure, like 8.5in or 8.5&quot;.
164 165 166 167 168 169 170 171 172 173
U.S. "letter" paper is exactly
8.5in&times;11in, approximately 21.6cm&times;27.9cm.  (See in the usage
documentation all the <a href="Use.htm#Known_paper_sizes">paper sizes
predefined in Ghostscript</a>.)</dd>

<dt>Points</dt>
<dd>Points are a measure traditionally used in the printing trade and now
in PostScript, which specifies exactly 72 points per inch (approximately
28.35 per centimeter).  The <a href="Use.htm#Known_paper_sizes">paper sizes
known to Ghostscript</a> are defined in the initialization file
174
<code>gs_statd.ps</code> in terms of points.</dd>
175 176

<dt>Dots per inch</dt>
177
<dd>Dots per inch or <dfn><abbr>dpi</abbr></dfn> is the common measure of
178 179 180
printing resolution in the US.</dd>

<dt>Bits per pixel</dt>
181
<dd>Commonly abbreviated <dfn><abbr>bpp</abbr></dfn> this is the number of
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
digital bits used to represent the color of each pixel. This is also referred
to as 'bit depth' or 'pixel depth'.</dd>

</dl>

<hr>

<h2><a name="File_formats"></a>Image file formats</h2>

<p>
Ghostscript supports output to a variety of image file formats
and is widely used for rasterizing postscript and pdf files.
A collection of such formats ('output devices' in Ghostscript terminology)
are described in this section.
</p>

<p>
Here are some commonly useful driver options that apply to all raster drivers.
Options specific to particular file formats are described in their respective
sections below.</p>

<blockquote><dl>

<dt>-sOutputFile=<em>filename</em></dt>
206
<dd><p>This is a general option telling Ghostscript what to name the output.
207
It can either be a single filename '<code>tiger.png</code>' or a template
208
    '<code>figure-%03d.jpg</code>' where the <code>%03d</code> is replaced by the page number.</p></dd>
209 210 211 212 213 214 215 216 217 218 219 220 221


<dt>-r<em>res</em></dt>
<dt>-r<em>xres</em>x<em>yres</em></dt>
<dd><p>This option sets the resolution of the output file in dots per inch.
The default value if you don't specify this options is usually 72 <abbr>dpi</abbr>.</p></dd>

<dt>-dTextAlphaBits=<em>n</em></dt>
<dt>-dGraphicsAlphaBits=<em>n</em></dt>
<dd><p>These options control the use of subsample antialiasing. Their use is highly recommended
for producing high quality rasterizations of the input files. The size of the subsampling
box <em>n</em> should be 4 for optimum output, but smaller values can be used for faster
rendering. Antialiasing is enabled separately for text and graphics content.</p></dd>
222
<p>Because this feature relies upon rendering the input it is incompatible, and will generate
223
an error on attempted use, with any of the vector output devices.</p>
224 225 226 227

</dl></blockquote>

<p>
228
It is also conventional to call Ghostscript with the '<code>-dSAFER -dBATCH -dNOPAUSE</code>' trio
229
of options when rasterizing to a file. These suppress interactive prompts and enable some
230 231 232
security checks on the file to be run. Please see the <a href="Use.htm">Use documentation</a>
for a complete description.
</p>
233

234 235 236 237 238
<h3><a name="PNG"></a>PNG file format</h3>

<p><acronym>PNG</acronym> (pronounced 'ping') stands for Portable Network Graphics,
and is the recommended format for high-quality images. It supports full quality
color and transparency, offers excellent lossless compression of the image data,
239
and is widely supported. Please see the
240 241 242 243
<a href="http://www.libpng.org/pub/png/pngintro.html" class="offsite">PNG website</a>
for a complete description of the format.</p>

<p>Ghostscript provides a variety of devices for <acronym>PNG</acronym> output
244 245 246 247
varying by bit depth. For normal use we recommend <code>png16m</code> for 24-bit RGB color,
or <code>pnggray</code> for grayscale. The <code>png256</code>, <code>png16</code> and
<code>pngmono</code> devices respectively provide 8-bit color, 4-bit color and
black-and-white for special needs. The <code>pngmonod</code> device is also a
248 249
black-and-white device, but the output is formed from an internal 8 bit grayscale
rendering which is then error diffused and converted down to 1bpp.</p>
250

251
<p>The <code>pngalpha</code> device is 32-bit RGBA color with transparency
252 253
indicating pixel coverage.  The background is transparent unless
it has been explicitly filled.  PDF 1.4 transparent files do not
254
give a transparent background with this device.  Text and graphics
255 256 257 258
anti-aliasing are enabled by default.</p>

<h4>Options</h4>

259 260
<p>The <code>pngmonod</code>, <code>png16m</code>, <code>pnggray</code> and
<code>pngalpha</code> devices all respond to the following:</p>
261 262 263

<blockquote>
<dl>
264
<dt><code>-dDownScaleFactor=</code><b><em>integer</em></b></dt>
265
<dd>This causes the internal rendering to be scaled down by the given (integer <= 8) factor before being output. For example, the following will produce
266
a 200dpi output png from a 600dpi internal rendering:</dd>
267 268 269
<blockquote>
<pre>
 <kbd>gs -sDEVICE=png16m -r600 -dDownScaleFactor=3 -o tiger.png\
270
      examples/tiger.eps</kbd>
271 272 273 274 275 276
</pre>
</blockquote>

</dl>
</blockquote>

277
<p>The <code>pngmonod</code> device responds to the following option:</p>
278 279 280

<blockquote>
<dl>
281
<dt><code>-dMinFeatureSize=</code><em>state</em> (0 to 4; default = 1)</dt>
282 283
<dd>This option allows a minimum feature size to be set; if any output pixel
appears on its own, or as part of a group of pixels smaller than
284
<code>MinFeatureSize</code> x <code>MinFeatureSize</code>, it will be expanded to
285
ensure that it does. This is useful for output devices that are high
286
    resolution, but that have trouble rendering isolated pixels.</dd>
287 288 289 290

<dd>While this parameter will accept values from 0 to 4, not all are fully
implemented. 0 and 1 cause no change to the output (as expected). 2 works
as specified. Values of 3 and 4 are accepted for compatibility, but
291
behave as for 2.</dd>
292 293 294
</dl>
</blockquote>

295
<p>The <code>pngalpha</code> device responds to the following option:</p>
296 297 298

<blockquote>
<dl>
299 300
<dt><code>-dBackgroundColor=</code><b><em>16#RRGGBB</em></b> (RGB color, default white = 16#ffffff)</dt>
<dd>For the <code>pngalpha</code> device only,
301
set the suggested background color in the PNG bKGD chunk.
302 303 304 305 306 307 308 309
When a program reading a PNG file does not support alpha
transparency, the PNG library converts the image using
either a background color if supplied by the program
or the bKGD chunk.
One common web browser has this problem, so when using
<code>&lt;body bgcolor="CCCC00"&gt;</code> on a web page
you would need to use <code>-dBackgroundColor=16#CCCC00</code>
when creating alpha transparent PNG images for use on the
310
page.</dd>
311 312 313 314 315
</dl>
</blockquote>

<h4>Examples</h4>

316
<p>Examples of how to use Ghostscript to convert postscript to PNG image files:</p>
317 318 319 320 321

<blockquote>
<pre>
 <kbd>gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dGraphicsAlphaBits=4 \
      -sOutputFile=tiger.png examples/tiger.png</kbd>
322

323 324 325 326 327 328 329 330 331
 <kbd>gs -dSAFER -dBATCH -dNOPAUSE -r150 -sDEVICE=pnggray -dTextAlphaBits=4 \
      -sOutputFile=doc-%02d.png doc.pdf</kbd>
</pre>
</blockquote>

<h3><a name="JFIF"></a>JPEG file format (JFIF)</h3>

<p>
Ghostscript includes output drivers that can produce jpeg files
332
from postscript or pdf images. These are the <code>jpeg</code> and
333
    <code>jpeggray</code> devices.</p>
334 335 336 337 338 339 340 341 342 343 344

<p>Technically these produce <a href="http://www.ijg.org/">Independent JPEG Group</a>
JFIF (JPEG File Interchange Format) files, the common sort found on the web.</p>

<p><strong>Please note</strong> that
JPEG is a compression method specifically intended for continuous-tone
images such as photographs, not for graphics, and it is therefore quite
unsuitable for the vast majority of page images produced with PostScript.
For anything other than pages containing simple images the lossy compression
of the jpeg format will result in poor quality output regardless of the input.
To learn more about the distinction, consult a reference about uses and abuses of JPEG,
345
such as the JPEG FAQ</p>
346 347 348 349 350 351 352 353 354 355 356

<blockquote>
<a href="http://www.faqs.org/faqs/jpeg-faq/" class="offsite">http://www.faqs.org/faqs/jpeg-faq/</a>
</blockquote>

<h4>Examples</h4>

<p>
You can use the JPEG output drivers -- <code>jpeg</code> to produce
color JPEG files and <code>jpeggray</code> for grayscale JPEGs -- the
same as other file-format drivers: by specifying the device name and an
357
output file name, for example</p>
358 359 360 361 362 363 364 365 366 367 368 369 370

<blockquote>
<pre><kbd>gs -sDEVICE=jpeg -sOutputFile=foo.jpg foo.ps</kbd></pre>
</blockquote>

<h4>Options</h4>

<p>
The JPEG devices support several special parameters to control the JPEG
"quality setting" (DCT quantization level).</p>

<blockquote>
<dl>
371
<dt><code>-dJPEGQ=</code><b><em>N</em></b> (integer from 0 to 100, default 75)</dt>
372 373 374 375
<dd>Set the quality level <b><em>N</em></b> according to the widely used
IJG quality scale, which balances the extent of compression against the
fidelity of the image when reconstituted.  Lower values drop more
information from the image to achieve higher compression, and therefore
376
have lower quality when reconstituted.</dd>
377

378
<dt><code>-dQFactor=</code><b><em>M</em></b> (float from 0.0 to 1.0)</dt>
379 380
<dd>Adobe's QFactor quality scale, which you may use in place of
<code>JPEGQ</code> above.  The QFactor scale is used by PostScript's
381
DCTEncode filter but is nearly unheard-of elsewhere.</dd>
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
</dl>
</blockquote>

<p>
At this writing the default JPEG quality level of 75 is equivalent to
<code>-dQFactor=0.5</code>, but the JPEG default might change in the
future.  There is currently no support for any additional JPEG
compression options, such as the other DCTEncode filter parameters.
</p>


<h3><a name="PNM"></a>PNM</h3>

<p>The PNM (portable network map) family of formats are very simple
uncompressed image formats commonly used on unix-like systems. They
are particularly useful for testing or as input to an external conversion
utility.</p>

<p>A wide variety of data formats and depths is supported. Devices include
401
<code>pbm
402
   pbmraw pgm pgmraw pgnm pgnmraw pnm pnmraw ppm ppmraw pkm pkmraw pksm
403
   pksmraw</code>.
404
</p>
405

406 407 408 409
<h3><a name="TIFF"></a>TIFF file formats</h3>

<p><acronym>TIFF</acronym> is a loose collection of formats, now largely
superceded by <acronym>PNG</acronym> except in applications where backward
410
compatibility or special compression is required. The <acronym>TIFF</acronym>
411
file format is described in the
412
<a href="http://partners.adobe.com/asn/developer/pdfs/tn/TIFF6.pdf" class="offsite">TIFF 6.0 Specification</a>
413
published by Adobe Systems Incorporated.</p>
414 415 416 417
<p>Note that, due to the structure of the TIFF format, writing TIFF output
requires that the target file be seekable. Writing to stdout, pipes or other
similar stream is not supported. Attempting to do so will generate an error.
</p>
418 419
<p>
There are two unrelated sets of TIFF drivers.  There are five color TIFF
420
drivers that produce uncompressed output:</p>
421 422 423

<blockquote>
<dl>
424 425 426 427 428 429 430 431 432 433 434 435 436
<dt><code>tiffgray</code></dt>
<dd>Produces 8-bit gray output.</dd>
<dt><code>tiff12nc</code></dt>
<dd>Produces 12-bit RGB output (4 bits per component).</dd>
<dt><code>tiff24nc</code></dt>
<dd>Produces 24-bit RGB output (8 bits per component).</dd>
<dt><code>tiff48nc</code></dt>
<dd>Produces 48-bit RGB output (16 bits per component).</dd>
<dt><code>tiff32nc</code></dt>
<dd>Produces 32-bit CMYK output (8 bits per component).</dd>
<dt><code>tiff64nc</code></dt>
<dd>Produces 64-bit CMYK output (16 bits per component).</dd>
<a name="tiffsep"></a><dt><code>tiffsep</code></dt>
437
<dd>
438
The <code>tiffsep</code> device creates multiple output files: a single 32 bit
439
composite CMYK file and multiple tiffgray files, one for each
440 441 442
separation (unless <code>-dNoSeparationFiles</code> is specified). If separation
files are being produced and more than one page is being generated, the output file
specification <b>must</b> include a format specifier (e.g <code>-o outfile-%d.tif</code>)
443
so that each page can have a uniquely named set of separation files.</dd>
444 445

<p>The default compression is <code>lzw</code> but this may be overridden by
446
the <code>-sCompression=</code> option.</p>
447 448

<p>
449 450
The file specified via the OutputFile command line parameter will contain
CMYK data. This data is based upon the CMYK data within the file plus
451 452
an equivalent CMYK color for each spot color. The equivalent
CMYK color for each spot color is determined using the alternate tint transform
453
function specified in the Separation and DeviceN color spaces. Since
454
this file is created based upon having color planes for each colorant, the
455
file will correctly represent the appearance of overprinting with spot colors.</p>
456 457

<p>
458 459 460 461
File names for the separations for the CMYK colorants are created by appending
'.Cyan.tif', '.Magenta.tif' '.Yellow.tif' or '.Black.tif' to the
end of the file name specified via the OutputFile parameter.
File names for the spot color separation files are created by appending the
462
Spot color name in '(' and ').tif' to the filename.</p>
463 464

<p>
465 466
If desired the file names for the spot color separation files can be created
by appending '.sn.tif'  (where n is the spot color number, see below) to the end
467
of the file name specified via the OutputFile parameter.   This change is a
468 469
compile time edit.  To obtain this type of output the function
create_separation_file_name in gdevtsep.c should be called with a true value
470
for its use_sep_name parameter.</p>
471 472

<p>
473
The <code>tiffsep</code> device will automatically recognize spot colors. In this
474 475
case their order is determined by when they are found in the input file.
The names of spot colors may be specified via the SeparationColorNames
476
device parameters.</p>
477 478 479 480 481 482 483

<p>
Internally each spot color is assigned a spot color number.  These
numbers start with 0 for the first spot color.  The spot color
numbers are assigned in the same order as the names are printed to
stderr (see below).  This order also matches the ordering in the
SeparationColorNames list, if this parameter is specified.  The
484
spot color numbers are not affected by the SeparationOrder parameter.</p>
485 486

<p>
487
If only a subset of the colorants for a file is desired, then the separations
488 489 490
to be output can be selected via the SeparationOrder
device parameter.  When colorants are selected via the
SeparationOrder parameter, the composite CMYK output contains
491
the equivalent CMYK data only for the selected colorants.</p>
492

493 494 495 496
<p>
NOTE: the composite CMYK output, because it uses the tint transformed
colour equivalents for any spot colours (see Postscript Language
Reference "Separation Color Spaces" and "DeviceN Color Spaces"), may
497
not produce an accurate preview, if the job uses overprinting.</p>
498

499
<p>
500
The <code>tiffsep</code> device also prints the names of any spot colors
501
detected within a document to stderr.  (stderr is also used for the
502
output from the bbox device.)  For each spot color, the name of
503 504
the color is printed preceded by '%%SeparationName:  '.  This
provides a simple mechanism for users and external applications to be informed about
505
the names of spot colors within a document.</p>
506 507

<p>
508
Generally Ghostscript will support a maximum of 64 process and spot
509 510
colors.   The <code>tiffsep</code> device the <code>psdcmyk</code> device
and the <code>psdcmyk16</code> devices maintain rendered data
511 512
in a planar form with a maximum of 64 planes set by the definition of
GS_CLIENT_COLOR_MAX_COMPONENTS in the code.  That is there can be up to
513 514
64 colorants accurately handled with overprint on a single page.  If more
than 64 colorants are encountered, those beyond 64 will be mapped to CMYK using the
515
alternate tint transform.</p>
516 517

<p>
518
When rendering a PDF document,  Ghostscript can deteremine prior to rendering how
519
many colorants occur on a particular page.  With Postscript, this is not possible
520
in general.  To optimize for this, when rendering Postscript, it is possible to specify
521 522
at run-time the number of spot colorants you wish to have the device capable
of handling using the -dMaxSpots=N command option, where N is the number of spot
523 524 525 526 527
colorants that you wish to be able to handle and must be
less than 60 (60 + 4 CMYK process colorants gets us to a
maximum of 64 colorants on a page).   If you specify more than
is needed, the document will render more slowly.   The ideal case is to use
the same number as the maximum number of spot colorants that occur on a single page
528 529
of the document.  If more spot colorants are encountered than is specified by
-dMaxSpots, then a warning will be printed indicating that some spot colorants will
530
be mapped to CMYK using the alternate tint transform.</p>
531

532
<p>The <code>tiffsep</code> device accepts a <code>-dBitsPerComponent=</code>
533 534 535 536
option, which may be set to 8 (the default) or 1. In 1bpp mode, the
device renders each component internally in 8 bits, but then converts
down to 1bpp with error diffusion before output as described below in
the <code>tiffscaled</code> device. No composite file is produced in
537
1bpp mode, only individual separations.</p>
538

539 540
<p>The device also accepts the <code>-dDownScaleFactor= -dTrapX= -dTrapy=</code> and
<code>-sPostRenderProfile=</code> parameters as described below in the tiffscaled device,
541
and <code>-dMinFeatureSize=</code> in 1bpp mode.</p>
542

543
<p>When <code>-dDownScaleFactor=</code> is used in 8 bit mode with the <code>tiffsep</code>
544 545
(and <code>psdcmyk</code>/<code>psdrgb</code>/<code>psdcmyk16</code>/<code>psdrgb16</code>)
device(s) 2 additional &quot;special&quot; ratios
546
are available, 32 and 34. 32 provides a 3:2 downscale (so from 300 to
547
200 dpi, say). 34 produces a 3:4 upscale (so from 300 to 400 dpi, say).</p>
548

549 550 551 552 553 554
<p>The <code>tiffscaled</code> and <code>tiffscaled4</code> devices
can optionally use Even Toned Screening, rather than simple Floyd Steinberg
error diffusion. This patented technique gives better quality at the
expense of some speed. While the code used has many quality tuning
options, none of these are currently exposed. Any device author
interested in trying these options should contact Artifex for more
555
information. Currently ETS can be enabled using -dDownScaleETS=1.</p>
556

557
<a name="tiffsep1"></a><dt><code>tiffsep1</code></dt>
558
<dd>
559
The <code>tiffsep1</code> device creates multiple output files, one for each component
560 561 562 563
or separation color. The device creates multiple tiffg4 files (the compression
can be set using -sCompression= described below). The 1 bit per component
output is halftoned using the current screening set by  'setcolorscreen'
or 'sethalftone' which allows for ordered dither or stochastic threshold
564
    array dither to be used. This is faster than error diffusion.</dd>
565 566 567

<p>
The file specified via the OutputFile command line parameter will not be
568
created (it is opened, but deleted prior to finishing each page).</p>
569 570

<p>
571 572 573
File names for the separations for the CMYK colorants are created by appending
'(Cyan).tif', '(Magenta).tif' '(Yellow).tif' or '(Black).tif' to the to the
end of the file name specified via the OutputFile parameter. File names
574 575 576 577
for the spot color separation files are created by appending the Spot color
name in '(' and ').tif' to the filename.
If the file name specified via the OutputFile parameter ends with the suffix
'.tif', then the suffix is removed prior to adding the component name in
578
'(' and ').tif'.</p>
579

580
<a name="tiffscaled"></a><dt><code>tiffscaled</code></dt>
581
<dd>
582
The <code>tiffscaled</code> device renders internally at the specified resolution to an
583
8 bit greyscale image. This is then scaled down by an integer scale factor
584
(set by <code>-dDownScaleFactor=</code> described below) and then error diffused to give
585
1bpp output. The compression can be set using -sCompression= as described
586 587
below.</dd>

588

589
<a name="tiffscaled4"></a><dt><code>tiffscaled4</code></dt>
590
<dd>
591
The <code>tiffscaled4</code> device renders internally at the specified resolution to an
592
8 bit cmyk image. This is then scaled down by an integer scale factor
593
(set by <code>-dDownScaleFactor</code>= described below) and then error diffused to give
594
4bpp cmyk output. The compression can be set using -sCompression= as described
595
below.</dd>
596

597
<a name="tiffscaled8"></a><dt><code>tiffscaled8</code></dt>
598
<dd>
599
The <code>tiffscaled8</code> device renders internally at the specified resolution to an
600
8 bit greyscale image. This is then scaled down by an integer scale factor
601
(set by <code>-dDownScaleFactor</code>= described below). The compression can be set using
602
-sCompression= as described below.</dd>
603

604
<a name="tiffscaled24"></a><dt><code>tiffscaled24</code></dt>
605
<dd>
606
The <code>tiffscaled24</code> device renders internally at the specified resolution to a
607
24 bit rgb image. This is then scaled down by an integer scale factor
608
(set by <code>-dDownScaleFactor</code>= described below). The compression can be set using
609
-sCompression= as described below.</dd>
610 611


612
<a name="tiffscaled32"></a><dt><code>tiffscaled32</code></dt>
613
<dd>
614
The <code>tiffscaled32</code> device renders internally at the specified resolution to a
615
32 bit cmyk image. This is then scaled down by an integer scale factor
616
(set by <code>-dDownScaleFactor</code>= described below). The compression can be set using
617
-sCompression= as described below.</dd>
618

619 620 621 622 623
</dl>
</blockquote>

<p>
The remaining TIFF drivers all produce black-and-white output with different
624
compression modes:</p>
625 626 627

<blockquote>
<dl>
628 629 630 631 632 633 634 635 636 637 638 639
<dt><code>tiffcrle</code></dt>
<dd>G3 fax encoding with no EOLs</dd>
<dt><code>tiffg3</code></dt>
<dd>G3 fax encoding with EOLs</dd>
<dt><code>tiffg32d</code></dt>
<dd>2-D G3 fax encoding</dd>
<dt><code>tiffg4</code></dt>
<dd>G4 fax encoding</dd>
<dt><code>tifflzw</code></dt>
<dd>LZW-compatible (tag = 5) compression</dd>
<dt><code>tiffpack</code></dt>
<dd>PackBits (tag = 32773) compression</dd>
640 641 642
</dl>
</blockquote>

643 644
<p>See the <code>AdjustWidth</code> option documentation below for important
information about these devices.</p>
645 646 647 648

<h4>Options</h4>

<p>
649 650 651
All TIFF drivers support creation of files that are comprised of more than a
single strip.  Multi-strip files reduce the memory requirement on the reader,
since readers need only store and process one strip at a time.  The
652
<code>MaxStripSize</code> parameter controls the strip size:</p>
653 654 655

<blockquote>
<dl>
656 657
<dt><code>-dMaxStripSize=<em>N</em></code> (non-negative integer; default = 8192)</dt>
<dd>Set the maximum (uncompressed) size of a strip.</dd>
658 659
</dl>
</blockquote>
660 661 662

<p>
The TIFF 6.0 specification, Section 7, page 27, recommends that the size of
663
each strip be about 8 Kbytes.</p>
664 665

<p>
666
If the value of the <code>MaxStripSize</code> parameter is smaller than a
667 668 669 670
single image row, then no error will be generated, and the TIFF file will be
generated correctly using one row per strip.  Note that smaller strip sizes
increase the size of the file by increasing the size of the StripOffsets and
StripByteCounts tables, and by reducing the effectiveness of the compression
671
which must start over for each strip.</p>
672 673

<p>
674
If the value of MaxStripSize is 0, then the entire image will be a single strip.</p>
675

676 677 678

<p>
Since v. 8.51 the logical order of bits within a byte, FillOrder, tag = 266 is
679
controlled by a parameter:</p>
680 681 682

<blockquote>
<dl>
683
<dt><code>-dFillOrder=<em>1 | 2 </em></code> (default = 1)</dt>
684 685
<dd>If this option set to 2 then pixels are arranged within a byte such that pixels
with lower column values are stored in the lower-order bits of the byte; otherwise
686
pixels are arranged in reverse order.</dd>
687 688
</dl></blockquote>

689
<p>Earlier versions of Ghostscript always generated TIFF files with FillOrder = 2.
690
According to the TIFF 6.0 specification, Section 8, page 32, support of
691
FillOrder = 2 is not required in a Baseline TIFF compliant reader</p>
692

693 694
<p>
The writing of BigTIFF format output files is controlled with the
695
<code>-dUseBigTIFF</code> parameter.</p>
696 697 698
<p>
Unfortunately, due the unpredictable size of compressed output, we cannot
automate the selection of BigTIFF, using it only when the output file
699
grows large enough to warrant it.</p>
700 701 702

<blockquote>
<dl>
703 704
<dt><code>-dUseBigTIFF(=<em>false/true</em>)</code> (boolean, default: false)</dt>
<dd>Force use (or not) of BigTIFF format in output from TIFF devices</dd>
705 706 707 708 709
</dl>
</blockquote>

<p>
The writing of the DateTime TAG can be controlled using the
710
<code>-dTIFFDateTime</code> parameter.</p>
711 712 713

<blockquote>
<dl>
714
<dt><code>-dTIFFDateTime(=<em>true/false</em>)</code> (boolean, default: true)</dt>
715
<dd>Write or otherwise the DateTime TAG to the TIFF output file. Thus to disable
716
writing the TAG, use: <code>-dTIFFDateTime=false</code></dd>
717 718 719
</dl>
</blockquote>

720 721
<p>
The compression scheme that is used for the image data can be set for all tiff
722
devices with:</p>
723 724 725

<blockquote>
    <dl>
726 727 728 729
    <dt><code>-sCompression=<em>none | crle | g3 | g4 | lzw | pack</em></code></dt>
    <dd>Change the compression scheme of the tiff device.
    <code>crle</code>, <code>g3</code>, and <code>g4</code> may only be
    used with 1 bit devices (including <code>tiffsep1</code>).</dd>
730 731 732 733
    </dl>
</blockquote>

<p>
734
For the <code>tiffsep</code> device, it changes the compression scheme
735
of the separation files and composite cmyk file (which is
736
<code>lzw</code> by default).  It defaults to <code>g4</code> for the
737
<code>tiffsep1</code> device.</p>
738 739

<p>
740
The black-and-white TIFF devices also provide the following parameters:</p>
741 742

<blockquote><dl>
743
<dt><code>-dAdjustWidth=<em>state</em></code> (0, 1, or value; default = 1)</dt>
744
<dd>If this option is 1 then if the requested page width is in the range
745
of either 1680..1736 or 2000..2056 columns, set the page width to A4
746
(1728 columns) or B4 (2048 columns) respectively. If this option is set
747
to a value &gt;1 then the width is unconditionally adjusted to this value.</dd>
748

749 750 751 752
<dd>This behavior is the default for all the fax based devices (i.e. all the black
and white devices except <code>tifflzw</code>, <code>tiffpack</code> and
<code>tiffscaled</code>). Pass <code>-dAdjustWidth=0</code> to force this behaviour
off.</dd>
753

754 755
<dd>When using this option with <code>tiffscaled</code> it is the downsampled size
that triggers the adjustment.</dd>
756

757
<dt><code>-dMinFeatureSize=<em>state</em></code> (0 to 4; default = 1)</dt>
758 759
<dd>This option allows a minimum feature size to be set; if any output pixel
appears on its own, or as part of a group of pixels smaller than
760
<code>MinFeatureSize</code> x <code>MinFeatureSize</code>, it will be expanded to
761
ensure that it does. This is useful for output devices that are high
762
resolution, but that have trouble rendering isolated pixels.</dd>
763 764 765 766

<dd>While this parameter will accept values from 0 to 4, not all are fully
implemented. 0 and 1 cause no change to the output (as expected). 2 works
as specified. 3 and 4 currently expand pixels correctly horizontally, but
767
only expand vertically to the 2 pixel size.</dd>
768

769 770
<dd>The mechanism by which <code>MinFeatureSize</code> is implemented for
<code>tiffscaled</code> is different, in that it is done as part of the error
771
diffusion. Values of 0 to 2 work as expected, but values 3 and 4 (while
772
accepted for compatibility) will behave as for 2.</dd>
773 774 775 776

</dl></blockquote>

<p>
777 778 779
The <code>tiffscaled</code>, <code>tiffscaled4</code>, <code>tiffscaled8</code>,
<code>tiffscaled24</code> and <code>tiffscaled32</code> TIFF
drivers also provide the following two parameters:</p>
780 781

<blockquote><dl>
782
<dt><code>-dDownScaleFactor=<em>factor</em></code> (small non-negative integer; default = 1)</dt>
783 784
<dd>If this option set then the page is downscaled by the given factor on both
axes before error diffusion takes place. For example rendering with
785 786
<code>-r600</code> and then specifying <code>-dDownScaleFactor=3</code> will produce
a 200dpi image.</dd>
787 788
</dl></blockquote>

789
<blockquote><dl>
790
<dt><code>-sPostRenderProfile=<em>path</em></code> (path to an ICC profile)</dt>
791
<dd>If this option set then the page will be color transformed using that
792
profile <b>after</b> downscaling.</dd>
793 794 795
<p>
This is useful when the file uses overprint to separately paint to some
subset of the C, M, Y, and K colorants, but the final CMYK is to be color
796
corrected for printing or display.</p>
797 798
</dl></blockquote>

799
<p>
800
The <code>tiffsep</code> TIFF device also provide this parameter:</p>
801 802 803 804 805

<blockquote><dl>
<dt><code>-dPrintSpotCMYK=<em>boolean</em></code> defaults to false. When set to true
the device will print (to stdout) the name of each ink used on the page, and the CMYK
values which are equivalent to 100% of that ink. The values are 16-bits ranging from 0
806
to 32760.</dt>
807 808 809 810 811 812
</dl></blockquote>

<a name="TIFF_trapping"></a>
<p>The <code>tiffsep</code> device (along with the <code>tiffscaled32</code> and
<code>psdcmyk</code> devices) can perform rudimentary automatic bitmap
'trapping' on the final rendered bitmap. This code is disabled by default; see
813
the <a href="#trapping_patent_note">note</a> below as to why.</p>
814 815 816 817 818 819

<p>Trapping is a process whereby the output is adjusted to minimise the
visual impact of offsets between each printed plane. Typically this involves
slightly extending abutting regions that are rendered in different inks. The
intent of this is to avoid the unsightly gaps that might be otherwise be
revealed in the final printout if the different color plates do not exactly
820
line up.</p>
821 822

<p>This trapping is controlled by 3 device parameters. Firstly the maximum
823
X and Y offsets are specified using <code>-dTrapX=N</code> and <code>-dTrapY=N</code>
824
(where <code>N</code> is a figure in pixels, before the downscaler is applied).</p>
825 826 827 828 829 830

<p>The final control is to inform the trapping process in what order inks
should be processed, from darkest to lightest. For a typical CMYK device
this order would be [ 3 1 0 2 ] (K darker than M darker than C darker than Y).
This is the default. In the case where CMYK + spots are used, the code
defaults to assuming that the spots are lighter than the standard colours
831
and are sent darkest first (thus [ 3 1 0 2 4 5 6 ... ]).</p>
832

833
<p>To override these defaults, the <code>TrapOrder</code> parameter can be used, for
834
example:</p>
835

836
<blockquote><code>
837
    gs -sDEVICE=psdcmyk -dTrapX=2 -dTrapY=2 -o out.psd -c "&lt;&lt; /TrapOrder [ 4 5 3 1 0 2 ] &gt;&gt; setpagedevice" -f examples\tiger.eps
838
</code></blockquote>
839

840 841
<h4><a name="trapping_patent_note"></a>Trapping patents</h4>

842 843 844
<p>Trapping is an technology area encumbered by many patents. We
believe that the last of these has now lapsed, and so have enabled
the code by default.</p>
845

846 847 848
<h3><a name="fax"></a>FAX</h3>

<p>
849
Ghostscript supports a variety of fax encodings, both encapsulated in
850 851 852 853 854
<acronym>TIFF</acronym> (see above) and as raw files. The later case is
described here.
</p>

<p>
855
The fax devices are <code>faxg3</code>, <code>faxg32d</code> and <code>faxg4</code>.
856 857
</p>

858
<p>
859
The fax devices support the <code>MinFeatureSize</code> parameter as defined in
860 861 862
the TIFF device section.
</p>

863 864 865 866
<h3><a name="BMP"></a>BMP</h3>

<p>
BMP is a simple uncompressed image format commonly used on MS Windows.
867 868
It is supported by the devices <code>bmpmono bmpgray bmpsep1
   bmpsep8 bmp16 bmp256 bmp16m bmp32b</code>.
869 870 871 872 873 874 875
</p>

<h3><a name="PCX"></a>PCX</h3>

<p>
PCX is an image format sometimes used on MS Windows. It has some support
for image compression and alternate color spaces, and so can be a useful
876
way to output CMYK.
877
It is supported by the <code>pcxmono pcxgray pcx16 pcx256 pcx24b pcxcmyk</code>
878 879 880 881 882 883 884
series of devices.
</p>

<h3><a name="PSD"></a>PSD</h3>

<p>
PSD is the image format used by Adobe Photoshop.
885 886 887
It is supported by the <code>psdcmyk</code>, <code>psdrgb</code>
<code>psdcmyk16</code> and <code>psdrgb16</code> devices.
Of special interest with the <code>psdcmyk</code> and <code>psdcmyk16</code> devices is that they support spot
888 889
colors.  <a href="#tiffsep">See the comments under the <code>tiffsep</code> and <code>tiffsep1</code>
device about the maximum number of spot colors supported by Ghostscript</a></p>
890
<p>
891 892 893 894
The <code>psdcmyk16</code> and <code>psdrgb16</code> devices are essentially the same
as the <code>psdcmyk</code> and <code>psdrgb</code> devices except they provide 16 bit output.
</p>
<p>
895
The <code>psdcmykog</code> device produces PSD files with 6 components:
896
Cyan, Magenta, Yellow, blacK, Orange, and Green.  This device does not support the -dDownScaleFactor=
897
option (see below), instead it always scales down by a factor of two.</p>
898

899
<p>
900 901 902
These devices support the same -dDownScaleFactor= ratios as <code>tiffsep</code>.
The <code>psdcmyk</code> device supports the same trapping options as <code>tiffsep</code>
(but see <a href="#trapping_patent_note">this note</a>).</p>
903

904 905 906 907 908
<p>
NOTE: The PSD format is a single image per file format, so you must use the &quot%d&quot
format for the &quotOutputFile&quot (or &quot-o&quot) file name parameter (see
<a href="Use.htm#One_page_per_file">One_page_per_file</a> for details). An attempt
to output multiple pages to a single PSD file (i.e. without the &quot%d&quot format) will
909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932
result in an <code>ioerror</code> Postscript error.</p>

<h3><a name="PDFimage"></a>PDF image output</h3>

<p>
These devices render input to a bitmap (or in the case of PCLm multiple bitmaps) then wraps
the bitmap(s) up as the content of a PDF file. For PCLm there are some additional rules regarding
headers, extra content and the order in which the content is written in the PDF file.
</p>
<p>
The aim is to support the PCLm mobile printing standard, and
to permit production of PDF files from input where the graphics
model differs significantly from PDF (eg PCL and RasterOPs).
</p>
<p>
There are four devices named pdfimage8, pdfimage24, pdfimage32 and PCLm. These produce valid
PDF files with a colour depth of 8 (Gray), 24 (RGB) or 32 (CMYK), the PCLm device only supports 24-bit RGB.
These are all implemented as 'downscale' devices, which means they can implement page level
anti-aliasing using the <code>-dDownScaleFactor</code> switch.
</p>
<blockquote>
<dl>
<dt><code>-dDownScaleFactor=</code><b><em>integer</em></b></dt>
<dd>This causes the internal rendering to be scaled down by the given (integer <= 8) factor before being output. For example, the following will produce
933
    a PDF containing a 200dpi output from a 600dpi internal rendering:</dd></dl>
934 935 936 937
<blockquote>
<pre>
 <kbd>gs -sDEVICE=pdfimage8 -r600 -dDownScaleFactor=3 -o tiger.pdf\
      examples/tiger.eps</kbd>
938
</pre>
939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957
</blockquote>
</blockquote>

<p>
The type of compression used for the image data can also be selected using the <code>-sCompression</code> switch.
Valid compression types are <code>None</code>, <code>LZW</code>, <code>Flate</code>, <code>JPEG</code>
and <code>RLE</code>.Note that LZW is not supported on PCLm (not valid) and None is only supported
on PCLm for debugging purposes.
</p>
<p>
Finally, the PCLm device supports the <code>-dStripHeight</code> switch to set the vertical height
of the strips of image content, as required by the specification.
</p>

<p>
For JPEG compression the devices support both the JPEGQ and QFactor switches as documented for the <a href="#JFIF">JPEG</a> file format device.
</p>

<hr>
958 959 960 961 962 963 964

<p>
In addition to raster image files, Ghostscript supports output in a number
of 'high-level' formats. These allow Ghostscript to preserve (as much as
possible) the drawing elements of the input file maintaining flexibility,
resolution independence, and editability.</p>

965 966
<h2><a name="High-level"></a>High-level devices</h2>

967 968
<h3><a name="PDF"></a>PDF writer</h3>

969
<p>The <code>pdfwrite</code> device outputs PDF.</p>
970

971 972
<h3><a name="PS"></a>PS2 writer</h3>

973
<p>The <code>ps2write</code> device outputs postscript language level 2.
974
It is recommnded that this device is used for PostScript output.
975
There is no longer any support for creating PostScript level 1 output.</p>
976

977 978
<h3><a name="EPS"></a>EPS writer</h3>

979
<p>The <code>eps2write</code> device outputs encapsulated postscript.</p>
980 981
<h3><a name="PXL"></a>PXL</h3>

982 983
<p>The <code>pxlmono</code> and <code>pxlcolor</code> devices output HP PCL-XL,
a graphic language understood by many recent laser printers.</p>
984

985

986 987 988
<h3><a name="TXT"></a>Text output</h3>

<p> The txtwrite device will output the text contained in the original
989
document as Unicode.</p>
990

991 992 993 994
<p>  Please refer to
<a href="VectorDevices.htm">VectorDevices.htm</a> for documentation on the
device options for these devices.
</p>
995 996 997 998 999 1000 1001 1002 1003 1004

<hr>

<h2><a name="Display_devices"></a>Display Devices</h2>

<p>
Ghostscript is often used for screen display of postscript and pdf documents.
In many cases, a client or 'viewer' application calls the Ghostscript engine
to do the rasterization and handles the display of the resulting image itself,
but it is also possible to invoke Ghostscript directly and select an output
1005
device which directly handles displaying the image on screen.</p>
1006 1007 1008

<p>
This section describes the various display-oriented devices that are available
1009
in Ghostscript.</p>
1010 1011 1012 1013 1014 1015

<h3><a name="x11_devices"></a>X Window System</h3>

<p>
Perhaps the most common use of of a display device is with the X Window System
on unix-like systems. It is the default device on the command line client on
1016
such systems, and is used more creatively by the gv client application.</p>
1017 1018

<p>
1019
The available devices are:</p>
1020 1021

<dl>
1022 1023
<dt><b>x11</b></dt>
<dd>This is the default device, handling display on X11R6.</dd>
1024

1025 1026 1027 1028
<dt><b>x11alpha</b></dt>
<dd>This is the <code>x11</code> device, but with antialiasing. It is equivalent to
invoking the <code>x11</code> device with the options <code>-dGraphicsAlphaBits=4
-dTextAlphaBits=4 -dMaxBitmap=50000000</code>.</dd>
1029

1030
<dt><b>x11cmyk</b></dt>
1031
<dd>This device rasterizes the image in the CMYK color space, then flattens
1032
it to RGB for display. It's intended for testing only.</dd>
1033

1034 1035
<dt><b>x11mono</b></dt>
<dd>This is a strict black-and-white device for 1-bit monochrome displays.</dd>
1036

1037 1038
<dt><b>x11gray2</b></dt>
<dd>This is a device for 2 bpp (4-level) monochrome displays.</dd>
1039

1040 1041
<dt><b>x11gray4</b></dt>
<dd>This is a device for 4 bpp (16-level) monochrome displays.</dd>
1042 1043
</dl>

1044 1045
<p>On Mac OS X as of 10.6, the X server (XQuartz) only supports color depth
15 and 24. Depth 15 isn't well-tested, and it may be desirable, for serious
1046
use, to switch to depth 24 with:</p>
1047 1048 1049 1050 1051

<blockquote><code>
defaults write org.x.X11 depth 24
</code></blockquote>

1052 1053
<h3><a name="display_device"></a>display device (MS Windows, OS/2, gtk+)</h3>
<p>
1054
The <code>display</code> device is used by the MS Windows,
1055 1056 1057 1058 1059 1060 1061 1062 1063
OS/2 and the gtk+ versions of ghostscript.
</p>

<h4>Options</h4>

<p>The display device has several user settable options.</p>

<blockquote>
<dl>
1064
<dt><code>-dDisplayFormat=</code><b><em>N</em></b> (integer bit-field)</dt>
1065
<dd>Some common values are 16#30804 for Windows RGB, 16#804 for gtk+ RGB,
1066
16#20101 for Windows monochrome, 16#102 for gtk+ monochrome,
1067
16#20802 grayscale, 16#20808 for CMYK, 16#a0800 for separations.</dd>
1068 1069
The bit fields are
<ul>
1070
<li> native (1), gray (2), RGB (4), CMYK (8), or separation (80000)
1071 1072 1073 1074 1075 1076
color spaces.</li>
<li> unused first byte (40) or last byte (80).</li>
<li> 1 (100), 4 (400), or 8 (800) bits/component.</li>
<li> bigendian (00000 = RGB) or littleendian (10000 = BGR) order.</li>
<li> top first (20000) or bottom first (00000) raster.</li>
<li> 16 bits/pixel with 555 (00000) or 565 (40000) bitfields.</li>
1077
</ul>
1078 1079 1080
<p>For more details, see the <a href="API.htm#display">Ghostscript
Interpreter API.</a></p>
<dt><code>-dDisplayResolution=</code><b><em>DPI</em></b></dt>
1081 1082 1083
<dd>Set the initial resolution resolution for the display device.
This is used by the Windows clients to set the display device
resolution to the Windows display logical resolution.
1084
This can be overriden by the command line option
1085
<code>-r<em>DPI</em></code>.</dd>
1086 1087 1088 1089
</dl>

</blockquote>

1090 1091
<p>When using the separation color space, the following options may be set
using setpagedevice, as described in the PostScript Language Reference:</p>
1092 1093 1094

<blockquote>
<dl>
1095 1096
<dt><code>SeparationColorNames</code></dt>
<dd>An array giving the names of the spot colors</dd>
1097

1098
<dt><code>SeparationOrder</code></dt>
1099
<dd>An array giving the names and order of the colorants
1100
    to be output.</dd>
1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128
</dl>
</blockquote>


<hr>

<h2><a name="IJS"></a>IJS - Inkjet and other raster devices</h2>

<p>
IJS is a relatively new initiative to improve the quality and ease of
use of inkjet printing with Ghostscript. Using IJS, you can add new
drivers, or upgrade existing ones, without recompiling Ghostscript.
All driver authors are encouraged to adapt their drivers for IJS, and
if there is an IJS driver available for your printer, it should be
your first choice.
</p>

<p>Please see the <a href="http://www.linuxprinting.org/ijs/">IJS web
page</a> for more information about IJS, including a listing of
IJS-compatible drivers.
</p>

<p>
A typical command line for IJS is:
</p>

<blockquote>
<code>
1129
gs -dSAFER -sDEVICE=ijs -sIjsServer=hpijs
1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141
 -sDeviceManufacturer=HEWLETT-PACKARD -sDeviceModel='DESKJET 990'
 -dIjsUseOutputFD -sOutputFile=/dev/usb/lp1 -dNOPAUSE --
 examples/tiger.eps
</code>
</blockquote>


<p>
Individual IJS command line parameters are as follows:
</p>

<dl>
1142
<dt><code>-sIjsServer=</code><em>{path}</em></dt>
1143 1144 1145 1146 1147 1148 1149
<dd>Sets the pathname for the IJS server (ie printer driver).
Ghostscript will spawn a new process for this driver, and communicate
with it using the IJS protocol. The pathname need not be absolute,
as the PATH environment variable is searched, but it's probably a good
idea for robustness and security. Note also that if -dSAFER is not
specified, it's possible for PostScript code to set this parameter,
so it can cause arbitrary code to be executed. See the section on <a
1150
href="Use.htm#Security">Security</a> for more information.</dd>
1151 1152 1153
</dl>

<dl>
1154 1155
<dt><code>-sDeviceManufacturer=</code><em>{name}</em></dt>
<dt><code>-sDeviceModel=</code><em>{name}</em></dt>
1156 1157 1158 1159
<dd>These parameters select the device according to IEEE-1284 standard
device ID strings. In general, consult the documentation for the
driver to find the appropriate settings. Note that, if the value
contains a space, you'll want to quote the value in your shell, as
1160
in the example above.</dd>
1161 1162 1163
</dl>

<dl>
1164
<dt><code>-sIjsParams=</code><em>{params}</em></dt>
1165 1166 1167 1168 1169
<dd>This parameter allows you to set arbitrary IJS parameters on
the IJS driver. The format is a comma-separated list of
<code>key=value</code> pairs. If it is necessary to send a
value containing a comma or backslash, it can be escaped with
a backslash. Thus, <code>'-sIjsParams=Foo=bar,Baz=a\,b'</code> sets
1170
the parameter Foo to "bar", and Baz to "a,b".</dd>
1171 1172 1173
</dl>

<dl>
1174
<dt><code>-dIjsUseOutputFD</code></dt>
1175 1176 1177 1178 1179
<dd>This flag indicates that Ghostscript should open the output file
and pass a file descriptor to the server. If not set, Ghostscript
simply passes the filename set in OutputFile to the server. In most
cases, this flag won't matter, but if you have a driver which works
only with OutputFD (such as hpijs 1.0.2), or if you're using the
1180
-sOutputFile="|cmd" syntax, you'll need to set it.</dd>
1181 1182 1183
</dl>

<dl>
1184
<dt><code>-dBitsPerSample=</code><em>N</em></dt>
1185 1186
<dd>This parameter controls the number of bits per sample. The
default value of 8 should be appropriate for most work. For monochrome
1187
images, use -dBitsPerSample=1.</dd>
1188 1189 1190 1191 1192 1193 1194
</dl>

<p>Generic Ghostscript options that are particularly relevant for IJS
are summarized below:
</p>

<dl>
1195
<dt><code>-r</code><em>number</em></dt>
1196
<br><code>-r</code><em>number1</em><code>x</code><em>number2</em>
1197 1198 1199
<dd>Sets the resolution, in dpi. If the resolution is not specified,
Ghostscript queries the IJS server to determine the preferred resolution.
When the resolution is specified, it overrides the value (if any)
1200
preferred by the IJS server.</dd>
1201 1202 1203
</dl>

<dl>
1204 1205
<dt><code>-dDuplex</code></dt>
<dt><code>-dTumble</code></dt>
1206 1207 1208 1209
<dd>These flags enable duplex (two-sided) printing. Tumble controls
the orientation. When Tumble is false, the pages
are oriented suitably at the left or right. When Tumble is true,
the pages are oriented suitably for binding at the top or
1210
bottom.</dd>
1211 1212 1213
</dl>

<dl>
1214
<dt><code>-sProcessColorModel=</code><em>{name}</em></dt>
1215
<dd>Use this flag to select the process color model. Suitable values
1216
include DeviceGray, DeviceRGB, and DeviceCMYK.</dd>
1217 1218 1219 1220 1221 1222
</dl>

<h3>Building IJS</h3>

<p> IJS is included by default on Unix gcc builds, and also in
autoconf'ed builds. Others may need some makefile tweaking. First,
1223
make sure the IJS device is selected:</p>
1224 1225

<blockquote>
1226
DEVICE_DEVS2=&#36;(DD)ijs.dev
1227 1228 1229
</blockquote>

<p> Next, make sure that the path and execution type are set in
1230
the top level makefile. The values for Unix are as follows:</p>
1231 1232 1233 1234 1235 1236 1237 1238

<blockquote>
IJSSRCDIR=ijs
IJSEXECTYPE=unix
</blockquote>

<p> At present, "unix" and "win" are the only supported values for
IJSEXECTYPE. If neither sounds appropriate for your system, it's
1239
possible that more porting work is needed.</p>
1240 1241

<p> Last, make sure that ijs.mak is included in the top level makefile.
1242
It should be present right after the include of icclib.mak.</p>
1243 1244 1245 1246

<p> IJS is not inherently platform-specific. We're very much interested
in taking patches from people who have ported it to non-mainstream
platforms. And once it's built, you won't have to recompile Ghostscript
1247 1248
to support new drivers!</p>
<hr>
1249 1250 1251 1252 1253 1254
<h2><a name="Rinkj"></a>Rinkj - Resplendent inkjet driver</h2>

<p>The Rinkj driver is an experimental new driver, capable of driving
some Epson printers at a very high level of quality. It is not
currently recommended for the faint of heart.</p>

1255
<p>You will need to add the following line to your makefile:</p>
1256 1257

<blockquote>
1258
DEVICE_DEVS2=&#36;(DD)rinkj.dev
1259 1260 1261 1262 1263 1264 1265 1266 1267
</blockquote>

<p>Most of the configuration parameters, including resolution, choice
of printer model, and linearization curves, are in a separate setup
file. In addition, we rely heavily on an ICC profile for mapping
document colors to actual device colors.</p>

<p>A typical command line invocation is:</p>

1268
<blockquote><code>
1269 1270 1271
gs -r1440x720 -sDEVICE=rinkj -sOutputFile=/dev/usb/lp0
  -sSetupFile=lib/rinkj-2200-setup -sProfileOut=2200-cmyk.icm
  -dNOPAUSE -dBATCH file.ps
1272
</code></blockquote>
1273 1274 1275 1276 1277 1278

<p>
Individual Rinkj command line parameters are as follows:
</p>

<dl>
1279 1280
<dt><code>-sSetupFile=</code><em>{path}</em></dt>
<dd>Specifies the path for the setup file.</dd>
1281

1282
<dt><code>-sProfileOut=</code><em>{path}</em></dt>
1283 1284
<dd>Specifies the path for the output ICC profile. This profile should
be a <i>link</i> profile, mapping the ProcessColorModel (DeviceCMYK by
1285
default) to the device color space.</dd>
1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296
</dl>

<p>For 6- and 7-color devices, the target color space for the output
profile is currently a 4-component space. The conversion from this
into the 6- or 7-color space (the "ink split") is done by lookup
tables in the setup file.</p>

<p>Setup files are in a simple "Key: value" text format. Relevant keys
are:</p>

<dl>
1297 1298
<dt><code>Manufacturer:</code><em>{name}</em></dt>
<dt><code>Model:</code><em>{name}</em></dt>
1299 1300 1301
<dd>The manufacturer and model of the individual device, using the
same syntax as IEEE printer identification strings. Currently, the
only supported manufacturer string is "EPSON", and the only supported
1302
model strings are "Stylus Photo 2200" and "Stylus Photo 7600".</dd>
1303

1304
<dt><code>Resolution:</code><em>{x-dpi}</em>x<em>{y-dpi}</em></dt>
1305
<dd>The resolution in dpi. Usually, this should match the
1306 1307
Ghostscript resolution set with the <code>-r</code> switch. Otherwise,
the page image will be scaled.</dd>
1308

1309
<dt><code>Dither:</code><em>{int}</em></dt>
1310
<dd>Selects among variant dither options. Currently, the choices are
1311 1312
<code>1</code> for one-bit dither, and <code>2</code>, for a 2-bit variable
dot dither.</dd>
1313

1314
<dt><code>Aspect:</code><em>{int}</em></dt>
1315
<dd>Controls the aspect ratio for highlight dot placement. Valid
1316
values are <code>1</code>, <code>2</code>, and <code>4</code>. For best results,
1317
choose a value near the x resolution divided by the y resolution. For
1318
example, if resolution is 1440x720, aspect should be 2.</dd>
1319

1320
<dt><code>Microdot:</code><em>{int}</em></dt>
1321 1322 1323
<dd>Chooses a microdot size. On EPSON devices, this value is passed
directly through to the "ESC ( e" command. See EPSON documentation
for further details (see, I <em>told</em> you this wasn't for the
1324
faint of heart).</dd>
1325

1326
<dt><code>Unidirectional:</code><em>{int}</em></dt>
1327
<dd>Enables (1) or disables (0) unidirectional printing, which is
1328
slower but possibly higher quality.</dd>
1329

1330
<dt><code>AddLut:</code><em>{plane}</em></dt>
1331 1332 1333 1334 1335
<dd>Adds a linearization look-up table. The plane is one of
"CcMmYKk". The lookup table data follows. The line immediately
following AddLut is the number of data points. Then, for each data
point is a line consisting of two space-separated floats - the output
value and the input value. If more than one LUT is specified for a
1336
single plane, they are applied in sequence.</dd>
1337 1338
</dl>

1339
<p>A typical setup file is supplied in <code>lib/rinkj-2200-setup</code>.
1340
It is configured for the 2200, but can be adapted to the 7600 just by
1341
changing the "Model" line.</p>
1342 1343 1344 1345