Train Tumble Mac OS
About This Game Note: Saving layouts is disabled in the demo. Take playing with trains into the virtual world in ‘My Train World’. ‘My Train World’ allows players of all ages to immerse themselves into puzzle-solving and world building. Master a variety of puzzles at different difficulty levels in Puzzle Mode.Complete incomplete layouts by adding missing track pieces in the correct. While using: Choose whether your Mac performs the action only when you're using a particular app. Perform: Choose the action to perform. You can open a Finder item, open a URL, paste text, paste data from the clipboard, press a keyboard shortcut, select a menu item, or run an Automator workflow. Use the checkboxes to turn commands on or off.
Table of contents
For other information, see the Ghostscriptoverview. You may also be interested in how tobuild Ghostscript and install it, as well asthe description of the driver interface.
Documentation for some older, superceded devices has been moved toanother document. In general such devices are deprecatedand will be removed in future versions of Ghostscript. In general all older printerdrivers can be replaced by the ijs interface and one of the available 3rd party rasterdriver collections. We recommend moving to the ijs device for all such printing.
Notes on measurements
Several different important kinds of measures appear throughout thisdocument: inches, centimeters and millimeters, points, and bits per pixel.
- Centimeters and millimeters
- ISO standard paper sizes such as A4 and A3 are commonly represented inthe SI units of centimeters and millimeters. Centimeters are abbreviatedcm, millimeters mm. ISO A4 paper isquite close to 210×297 millimeters (approximately 8.3×11.7inches).
- Inches
- 1 inch equals 2.54 centimeters. The inch measure is sometimesrepresented by in or a quotation mark(') to the rightof a measure, like 8.5in or 8.5'.U.S. 'letter' paper is exactly8.5in×11in, approximately 21.6cm×27.9cm. (See in the usagedocumentation all the paper sizespredefined in Ghostscript.)
- Points
- Points are a measure traditionally used in the printing trade and nowin PostScript, which specifies exactly 72 points per inch (approximately28.35 per centimeter). The paper sizesknown to Ghostscript are defined in the initialization file
gs_statd.ps
in terms of points. - Dots per inch
- Dots per inch or dpi is the common measure ofprinting resolution in the US.
- Bits per pixel
- Commonly abbreviated bpp this is the number ofdigital bits used to represent the color of each pixel. This is also referredto as 'bit depth' or 'pixel depth'.
Image file formats
Ghostscript supports output to a variety of image file formatsand is widely used for rasterizing postscript and pdf files.A collection of such formats ('output devices' in Ghostscript terminology)are described in this section.
Here are some commonly useful driver options that apply to all raster drivers.Options specific to particular file formats are described in their respectivesections below.
This is a general option telling Ghostscript what to name the output.It can either be a single filename 'tiger.png
' or a template 'figure-%03d.jpg
' where the %03d
is replaced by the page number.
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 dpi.
These options control the use of subsample antialiasing. Their use is highly recommendedfor producing high quality rasterizations of the input files. The size of the subsamplingbox n should be 4 for optimum output, but smaller values can be used for fasterrendering. Antialiasing is enabled separately for text and graphics content.
Because this feature relies upon rendering the input it is incompatible, and will generatean error on attempted use, with any of the vector output devices.
It is also conventional to call Ghostscript with the '-dSAFER -dBATCH -dNOPAUSE
' trioof options when rasterizing to a file. These suppress interactive prompts and enable somesecurity checks on the file to be run. Please see the Use documentationfor a complete description.
PNG file format
PNG (pronounced 'ping') stands for Portable Network Graphics,and is the recommended format for high-quality images. It supports full qualitycolor and transparency, offers excellent lossless compression of the image data,and is widely supported. Please see thePNG websitefor a complete description of the format.
Ghostscript provides a variety of devices for PNG outputvarying by bit depth. For normal use we recommend png16m
for 24-bit RGB color,or pnggray
for grayscale. The png256
, png16
andpngmono
devices respectively provide 8-bit color, 4-bit color andblack-and-white for special needs. The pngmonod
device is also ablack-and-white device, but the output is formed from an internal 8 bit grayscalerendering which is then error diffused and converted down to 1bpp.
The pngalpha
device is 32-bit RGBA color with transparencyindicating pixel coverage. The background is transparent unlessit has been explicitly filled. PDF 1.4 transparent files do notgive a transparent background with this device. Text and graphicsanti-aliasing are enabled by default.
Options
The pngmonod
, png16m
, pnggray
andpngalpha
devices all respond to the following:
-dDownScaleFactor=
integer- This causes the internal rendering to be scaled down by the given (integer <= 8) factor before being output. For example, the following will producea 200dpi output png from a 600dpi internal rendering:
The pngmonod
device responds to the following option:
-dMinFeatureSize=
state (0 to 4; default = 1)- This option allows a minimum feature size to be set; if any output pixelappears on its own, or as part of a group of pixels smaller than
MinFeatureSize
xMinFeatureSize
, it will be expanded toensure that it does. This is useful for output devices that are high resolution, but that have trouble rendering isolated pixels.- While this parameter will accept values from 0 to 4, not all are fullyimplemented. 0 and 1 cause no change to the output (as expected). 2 worksas specified. Values of 3 and 4 are accepted for compatibility, butbehave as for 2.
The pngalpha
device responds to the following option:
-dBackgroundColor=
16#RRGGBB (RGB color, default white = 16#ffffff)- For the
pngalpha
device only,set the suggested background color in the PNG bKGD chunk.When a program reading a PNG file does not support alphatransparency, the PNG library converts the image usingeither a background color if supplied by the programor the bKGD chunk.One common web browser has this problem, so when using<body bgcolor='CCCC00'>
on a web pageyou would need to use-dBackgroundColor=16#CCCC00
when creating alpha transparent PNG images for use on thepage.
Examples
Examples of how to use Ghostscript to convert postscript to PNG image files:
JPEG file format (JFIF)
Ghostscript includes output drivers that can produce jpeg filesfrom postscript or pdf images. These are the jpeg
and jpeggray
devices.
Technically these produce Independent JPEG GroupJFIF (JPEG File Interchange Format) files, the common sort found on the web.
Please note thatJPEG is a compression method specifically intended for continuous-toneimages such as photographs, not for graphics, and it is therefore quiteunsuitable for the vast majority of page images produced with PostScript.For anything other than pages containing simple images the lossy compressionof 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,such as the JPEG FAQ
http://www.faqs.org/faqs/jpeg-faq/
Examples
You can use the JPEG output drivers -- jpeg
to producecolor JPEG files and jpeggray
for grayscale JPEGs -- thesame as other file-format drivers: by specifying the device name and anoutput file name, for example
Options
The JPEG devices support several special parameters to control the JPEG'quality setting' (DCT quantization level).
-dJPEGQ=
N (integer from 0 to 100, default 75)- Set the quality level N according to the widely usedIJG quality scale, which balances the extent of compression against thefidelity of the image when reconstituted. Lower values drop moreinformation from the image to achieve higher compression, and thereforehave lower quality when reconstituted.
-dQFactor=
M (float from 0.0 to 1.0)- Adobe's QFactor quality scale, which you may use in place of
JPEGQ
above. The QFactor scale is used by PostScript'sDCTEncode filter but is nearly unheard-of elsewhere.
At this writing the default JPEG quality level of 75 is equivalent to-dQFactor=0.5
, but the JPEG default might change in thefuture. There is currently no support for any additional JPEGcompression options, such as the other DCTEncode filter parameters.
PNM
The PNM (portable network map) family of formats are very simpleuncompressed image formats commonly used on unix-like systems. Theyare particularly useful for testing or as input to an external conversionutility.
A wide variety of data formats and depths is supported. Devices includepbm pbmraw pgm pgmraw pgnm pgnmraw pnm pnmraw ppm ppmraw pkm pkmraw pksm pksmraw
.
TIFF file formats
TIFF is a loose collection of formats, now largelysuperceded by PNG except in applications where backwardcompatibility or special compression is required. The TIFFfile format is described in theTIFF 6.0 Specificationpublished by Adobe Systems Incorporated.
Note that, due to the structure of the TIFF format, writing TIFF outputrequires that the target file be seekable. Writing to stdout, pipes or othersimilar stream is not supported. Attempting to do so will generate an error.
There are two unrelated sets of TIFF drivers. There are five color TIFFdrivers that produce uncompressed output:
tiffgray
tiff12nc
tiff24nc
tiff48nc
tiff32nc
tiff64nc
tiffsep
tiffsep
device creates multiple output files: a single 32 bitcomposite CMYK file and multiple tiffgray files, one for eachseparation (unless -dNoSeparationFiles
is specified). If separationfiles are being produced and more than one page is being generated, the output filespecification must include a format specifier (e.g -o outfile-%d.tif
)so that each page can have a uniquely named set of separation files.The default compression is lzw
but this may be overridden bythe -sCompression=
option.
The file specified via the OutputFile command line parameter will containCMYK data. This data is based upon the CMYK data within the file plusan equivalent CMYK color for each spot color. The equivalentCMYK color for each spot color is determined using the alternate tint transformfunction specified in the Separation and DeviceN color spaces. Sincethis file is created based upon having color planes for each colorant, thefile will correctly represent the appearance of overprinting with spot colors.
File names for the separations for the CMYK colorants are created by appending'.Cyan.tif', '.Magenta.tif' '.Yellow.tif' or '.Black.tif' to theend of the file name specified via the OutputFile parameter.File names for the spot color separation files are created by appending theSpot color name in '(' and ').tif' to the filename.
If desired the file names for the spot color separation files can be createdby appending '.sn.tif' (where n is the spot color number, see below) to the endof the file name specified via the OutputFile parameter. This change is acompile time edit. To obtain this type of output the functioncreate_separation_file_name in gdevtsep.c should be called with a true valuefor its use_sep_name parameter.
The tiffsep
device will automatically recognize spot colors. In thiscase their order is determined by when they are found in the input file.The names of spot colors may be specified via the SeparationColorNamesdevice parameters.
Internally each spot color is assigned a spot color number. Thesenumbers start with 0 for the first spot color. The spot colornumbers are assigned in the same order as the names are printed tostderr (see below). This order also matches the ordering in theSeparationColorNames list, if this parameter is specified. Thespot color numbers are not affected by the SeparationOrder parameter.
If only a subset of the colorants for a file is desired, then the separationsto be output can be selected via the SeparationOrderdevice parameter. When colorants are selected via theSeparationOrder parameter, the composite CMYK output containsthe equivalent CMYK data only for the selected colorants.
NOTE: the composite CMYK output, because it uses the tint transformedcolour equivalents for any spot colours (see Postscript LanguageReference 'Separation Color Spaces' and 'DeviceN Color Spaces'), maynot produce an accurate preview, if the job uses overprinting.
The tiffsep
device also prints the names of any spot colorsdetected within a document to stderr. (stderr is also used for theoutput from the bbox device.) For each spot color, the name ofthe color is printed preceded by '%%SeparationName: '. Thisprovides a simple mechanism for users and external applications to be informed aboutthe names of spot colors within a document.
Generally Ghostscript will support a maximum of 64 process and spotcolors. The tiffsep
device the psdcmyk
deviceand the psdcmyk16
devices maintain rendered datain a planar form with a maximum of 64 planes set by the definition ofGS_CLIENT_COLOR_MAX_COMPONENTS in the code. That is there can be up to64 colorants accurately handled with overprint on a single page. If morethan 64 colorants are encountered, those beyond 64 will be mapped to CMYK using thealternate tint transform.
When rendering a PDF document, Ghostscript can deteremine prior to rendering howmany colorants occur on a particular page. With Postscript, this is not possiblein general. To optimize for this, when rendering Postscript, it is possible to specifyat run-time the number of spot colorants you wish to have the device capableof handling using the -dMaxSpots=N command option, where N is the number of spotcolorants that you wish to be able to handle and must be no more than the 64 minus thenumber of process colors. For example, 60 or less for a CMYK device such as tiffsep.If you specify more thanis needed, the document will render more slowly. The ideal case is to usethe same number as the maximum number of spot colorants that occur on a single pageof the document. If more spot colorants are encountered than is specified by-dMaxSpots, then a warning will be printed indicating that some spot colorants willbe mapped to CMYK using the alternate tint transform.
The tiffsep
device accepts a -dBitsPerComponent=
option, which may be set to 8 (the default) or 1. In 1bpp mode, thedevice renders each component internally in 8 bits, but then convertsdown to 1bpp with error diffusion before output as described below inthe tiffscaled
device. No composite file is produced in1bpp mode, only individual separations.
The device also accepts the -dDownScaleFactor= -dTrapX= -dTrapy=
and-sPostRenderProfile=
parameters as described below in the tiffscaled device,and -dMinFeatureSize=
in 1bpp mode.
When -dDownScaleFactor=
is used in 8 bit mode with the tiffsep
(and psdcmyk
/psdrgb
/psdcmyk16
/psdrgb16
)device(s) 2 additional 'special' ratiosare available, 32 and 34. 32 provides a 3:2 downscale (so from 300 to200 dpi, say). 34 produces a 3:4 upscale (so from 300 to 400 dpi, say).
The tiffscaled
and tiffscaled4
devicescan optionally use Even Toned Screening, rather than simple Floyd Steinbergerror diffusion. This patented technique gives better quality at theexpense of some speed. While the code used has many quality tuningoptions, none of these are currently exposed. Any device authorinterested in trying these options should contact Artifex for moreinformation. Currently ETS can be enabled using -dDownScaleETS=1.
tiffsep1
tiffsep1
device creates multiple output files, one for each componentor separation color. The device creates multiple tiffg4 files (the compressioncan be set using -sCompression= described below). The 1 bit per componentoutput is halftoned using the current screening set by 'setcolorscreen'or 'sethalftone' which allows for ordered dither or stochastic threshold array dither to be used. This is faster than error diffusion.The file specified via the OutputFile command line parameter will not becreated (it is opened, but deleted prior to finishing each page).
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 theend of the file name specified via the OutputFile parameter. File namesfor the spot color separation files are created by appending the Spot colorname 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'(' and ').tif'.
tiffscaled
tiffscaled
device renders internally at the specified resolution to an8 bit greyscale image. This is then scaled down by an integer scale factor(set by -dDownScaleFactor=
described below) and then error diffused to give1bpp output. The compression can be set using -sCompression= as describedbelow.tiffscaled4
tiffscaled4
device renders internally at the specified resolution to an8 bit cmyk image. This is then scaled down by an integer scale factor(set by -dDownScaleFactor
= described below) and then error diffused to give4bpp cmyk output. The compression can be set using -sCompression= as describedbelow.tiffscaled8
tiffscaled8
device renders internally at the specified resolution to an8 bit greyscale image. This is then scaled down by an integer scale factor(set by -dDownScaleFactor
= described below). The compression can be set using-sCompression= as described below.tiffscaled24
tiffscaled24
device renders internally at the specified resolution to a24 bit rgb image. This is then scaled down by an integer scale factor(set by -dDownScaleFactor
= described below). The compression can be set using-sCompression= as described below.tiffscaled32
tiffscaled32
device renders internally at the specified resolution to a32 bit cmyk image. This is then scaled down by an integer scale factor(set by -dDownScaleFactor
= described below). The compression can be set using-sCompression= as described below.The remaining TIFF drivers all produce black-and-white output with differentcompression modes:
tiffcrle
- G3 fax encoding with no EOLs
tiffg3
- G3 fax encoding with EOLs
tiffg32d
- 2-D G3 fax encoding
tiffg4
- G4 fax encoding
tifflzw
- LZW-compatible (tag = 5) compression
tiffpack
- PackBits (tag = 32773) compression
See the AdjustWidth
option documentation below for importantinformation about these devices.
Options
All TIFF drivers support creation of files that are comprised of more than asingle strip. Multi-strip files reduce the memory requirement on the reader,since readers need only store and process one strip at a time. TheMaxStripSize
parameter controls the strip size:
-dMaxStripSize=N
(non-negative integer; default = 8192)- Set the maximum (uncompressed) size of a strip.
The TIFF 6.0 specification, Section 7, page 27, recommends that the size ofeach strip be about 8 Kbytes.
If the value of the MaxStripSize
parameter is smaller than asingle image row, then no error will be generated, and the TIFF file will begenerated correctly using one row per strip. Note that smaller strip sizesincrease the size of the file by increasing the size of the StripOffsets andStripByteCounts tables, and by reducing the effectiveness of the compressionwhich must start over for each strip.
If the value of MaxStripSize is 0, then the entire image will be a single strip.
Since v. 8.51 the logical order of bits within a byte, FillOrder, tag = 266 iscontrolled by a parameter:
-dFillOrder=1 2
(default = 1)- If this option set to 2 then pixels are arranged within a byte such that pixelswith lower column values are stored in the lower-order bits of the byte; otherwisepixels are arranged in reverse order.
Earlier versions of Ghostscript always generated TIFF files with FillOrder = 2.According to the TIFF 6.0 specification, Section 8, page 32, support ofFillOrder = 2 is not required in a Baseline TIFF compliant reader
The writing of BigTIFF format output files is controlled with the-dUseBigTIFF
parameter.
Unfortunately, due the unpredictable size of compressed output, we cannotautomate the selection of BigTIFF, using it only when the output filegrows large enough to warrant it.
-dUseBigTIFF(=false/true)
(boolean, default: false)- Force use (or not) of BigTIFF format in output from TIFF devices
The writing of the DateTime TAG can be controlled using the-dTIFFDateTime
parameter.
-dTIFFDateTime(=true/false)
(boolean, default: true)- Write or otherwise the DateTime TAG to the TIFF output file. Thus to disablewriting the TAG, use:
-dTIFFDateTime=false
The compression scheme that is used for the image data can be set for all tiffdevices with:
-sCompression=none crle g3 g4 lzw pack
- Change the compression scheme of the tiff device.
crle
,g3
, andg4
may only be used with 1 bit devices (includingtiffsep1
).
For the tiffsep
device, it changes the compression schemeof the separation files and composite cmyk file (which islzw
by default). It defaults to g4
for thetiffsep1
device.
The black-and-white TIFF devices also provide the following parameters:
-dAdjustWidth=state
(0, 1, or value; default = 1)- If this option is 1 then if the requested page width is in the rangeof either 1680..1736 or 2000..2056 columns, set the page width to A4(1728 columns) or B4 (2048 columns) respectively. If this option is setto a value >1 then the width is unconditionally adjusted to this value.
- This behavior is the default for all the fax based devices (i.e. all the blackand white devices except
tifflzw
,tiffpack
andtiffscaled
). Pass-dAdjustWidth=0
to force this behaviouroff.- When using this option with
tiffscaled
it is the downsampled sizethat triggers the adjustment.-dMinFeatureSize=state
(0 to 4; default = 1)- This option allows a minimum feature size to be set; if any output pixelappears on its own, or as part of a group of pixels smaller than
MinFeatureSize
xMinFeatureSize
, it will be expanded toensure that it does. This is useful for output devices that are highresolution, but that have trouble rendering isolated pixels.- While this parameter will accept values from 0 to 4, not all are fullyimplemented. 0 and 1 cause no change to the output (as expected). 2 worksas specified. 3 and 4 currently expand pixels correctly horizontally, butonly expand vertically to the 2 pixel size.
- The mechanism by which
MinFeatureSize
is implemented fortiffscaled
is different, in that it is done as part of the errordiffusion. Values of 0 to 2 work as expected, but values 3 and 4 (whileaccepted for compatibility) will behave as for 2.
The tiffscaled
, tiffscaled4
, tiffscaled8
,tiffscaled24
and tiffscaled32
TIFFdrivers also provide the following two parameters:
-dDownScaleFactor=factor
(small non-negative integer; default = 1)- If this option set then the page is downscaled by the given factor on bothaxes before error diffusion takes place. For example rendering with
-r600
and then specifying-dDownScaleFactor=3
will producea 200dpi image.
-sPostRenderProfile=path
(path to an ICC profile)This is useful when the file uses overprint to separately paint to somesubset of the C, M, Y, and K colorants, but the final CMYK is to be colorcorrected for printing or display.
The tiffsep
TIFF device also provide this parameter:
-dPrintSpotCMYK=boolean
defaults to false. When set to truethe device will print (to stdout) the name of each ink used on the page, and the CMYKvalues which are equivalent to 100% of that ink. The values are 16-bits ranging from 0to 32760.
The tiffsep
device (along with the tiffscaled32
andpsdcmyk
devices) can perform rudimentary automatic bitmap'trapping' on the final rendered bitmap. This code is disabled by default; seethe note below as to why.
Trapping is a process whereby the output is adjusted to minimise thevisual impact of offsets between each printed plane. Typically this involvesslightly extending abutting regions that are rendered in different inks. Theintent of this is to avoid the unsightly gaps that might be otherwise berevealed in the final printout if the different color plates do not exactlyline up.
This trapping is controlled by 3 device parameters. Firstly the maximumX and Y offsets are specified using -dTrapX=N
and -dTrapY=N
(where N
is a figure in pixels, before the downscaler is applied).
The final control is to inform the trapping process in what order inksshould be processed, from darkest to lightest. For a typical CMYK devicethis 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 codedefaults to assuming that the spots are lighter than the standard coloursand are sent darkest first (thus [ 3 1 0 2 4 5 6 ... ]).
To override these defaults, the TrapOrder
parameter can be used, forexample:
gs -sDEVICE=psdcmyk -dTrapX=2 -dTrapY=2 -o out.psd -c '<< /TrapOrder [ 4 5 3 1 0 2 ] >> setpagedevice' -f examplestiger.eps
Trapping patents
Trapping is an technology area encumbered by many patents. Webelieve that the last of these has now lapsed, and so have enabledthe code by default.
FAX
Ghostscript supports a variety of fax encodings, both encapsulated inTIFF (see above) and as raw files. The later case isdescribed here.
The fax devices are faxg3
, faxg32d
and faxg4
.
The fax devices support the MinFeatureSize
parameter as defined inthe TIFF device section.
BMP
BMP is a simple uncompressed image format commonly used on MS Windows.It is supported by the devices bmpmono bmpgray bmpsep1 bmpsep8 bmp16 bmp256 bmp16m bmp32b
.
PCX
PCX is an image format sometimes used on MS Windows. It has some supportfor image compression and alternate color spaces, and so can be a usefulway to output CMYK.It is supported by the pcxmono pcxgray pcx16 pcx256 pcx24b pcxcmyk
series of devices.
PSD
PSD is the image format used by Adobe Photoshop.It is supported by the psdcmyk
, psdrgb
psdcmyk16
and psdrgb16
devices.Of special interest with the psdcmyk
and psdcmyk16
devices is that they support spotcolors. See the comments under the tiffsep
and tiffsep1
device about the maximum number of spot colors supported by Ghostscript
The psdcmyk16
and psdrgb16
devices are essentially the sameas the psdcmyk
and psdrgb
devices except they provide 16 bit output.
The psdcmykog
device produces PSD files with 6 components:Cyan, Magenta, Yellow, blacK, Orange, and Green. This device does not support the -dDownScaleFactor=option (see below), instead it always scales down by a factor of two.
These devices support the same -dDownScaleFactor= ratios as tiffsep
.The psdcmyk
device supports the same trapping options as tiffsep
(but see this note).
NOTE: The PSD format is a single image per file format, so you must use the '%d'format for the 'OutputFile' (or '-o') file name parameter (seeOne_page_per_file for details). An attemptto output multiple pages to a single PSD file (i.e. without the '%d' format) willresult in an ioerror
Postscript error.
PDF image output
These devices render input to a bitmap (or in the case of PCLm multiple bitmaps) then wrapsthe bitmap(s) up as the content of a PDF file. For PCLm there are some additional rules regardingheaders, extra content and the order in which the content is written in the PDF file.
The aim is to support the PCLm mobile printing standard, andto permit production of PDF files from input where the graphicsmodel differs significantly from PDF (eg PCL and RasterOPs).
There are four devices named pdfimage8, pdfimage24, pdfimage32 and PCLm. These produce validPDF 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 levelanti-aliasing using the -dDownScaleFactor
switch.
-dDownScaleFactor=
integer- This causes the internal rendering to be scaled down by the given (integer <= 8) factor before being output. For example, the following will produce a PDF containing a 200dpi output from a 600dpi internal rendering:
The type of compression used for the image data can also be selected using the -sCompression
switch.Valid compression types are None
, LZW
, Flate
, JPEG
and RLE
.Note that LZW is not supported on PCLm (not valid) and None is only supportedon PCLm for debugging purposes.
Finally, the PCLm device supports the -dStripHeight
switch to set the vertical heightof the strips of image content, as required by the specification.
For JPEG compression the devices support both the JPEGQ and QFactor switches as documented for the JPEG file format device.
In addition to raster image files, Ghostscript supports output in a numberof 'high-level' formats. These allow Ghostscript to preserve (as much aspossible) the drawing elements of the input file maintaining flexibility,resolution independence, and editability.
Optical Character Recognition (OCR) devices
OCR text output
These devices render internally in 8 bit greyscale, and then feed the resultant image into an OCR engine. Currently, we are using the Tesseract engine. Not only is this both free and open source, it gives very good results, and supports a huge number of languages/scripts.
The Tesseract engine relies on files to encapsulate each language and/or script. These 'traineddata' files are available in different forms, including fast and best variants. Alternatively, people can train their own data using the standard Tesseract tools.
These files are looked for from a variety of places.
- Firstly, files will be searched for in the directory given by the environment variable TESSDATA_PREFIX.
- Next, they will be searched for within the ROM filing system. Any files placed in 'tessdata' will be included within the ROM filing system in the binary for any standard (COMPILE_INITS=1) build.
- Next, files will be searched for in the configured 'tessdata' path. On Unix, this can be specified at the configure stage using '--with-tessdata=<path>' (where <path> is a list of directories to search, separated by ':' (on Unix) or ';' (on Windows)).
- Finally, we resort to searching the current directory.
Please note, this pattern of directory searching differs from the original release of the OCR devices.
By default, the OCR process defaults to looking for English text, using 'eng.traineddata'. This can be changed by using the -sOCRLanguage=
switch;
-sOCRLanguage=
language- This sets the trained data sets to use within the Tesseract OCR engine. For example, the following will use English and Arabic:
The first device is named ocr. It extracts data as unicode codepoints and outputs them to the device as a stream of UTF-8 bytes.
The second device is named hocr. This extracts the data in hOCR format.
These devices are implemented as downscaling devices, so the standard parameters can be used to control this process. It may seem strange to use downscaling on an image that is not actually going to be output, but there are actually good reasons for this. Firstly, the higher the resolution, the slower the OCR process. Secondly, the way the Tesseract OCR engine works means that anti-aliased images perform broadly as well as the super-sampled image from which it came.
PDF image output (with OCR text)
These devices do the same render to bitmap and wrap as a PDF process as the PDFimage devices above, but with the addition of an OCR step at the end. The OCR'd text is overlaid 'invisibly' over the images, so searching and cut/paste should still work.
The OCR engine being used is Tesseract. For information on this including how to control what language data is used, see the OCR devices section above.
There are three devices named pdfocr8, pdfocr24 and pdfocr32. These produce valid PDF files with a colour depth of 8 (Gray), 24 (RGB) or 32 (CMYK).
These devices accept all the same flags as the PDFimage devices described above.
Vector PDF output (with OCR Unicode CMaps)
The pdfwrite device has been augmented to use the OCR engine to analyse text(not images!) in the input stream, and derive Unicode code points for it.That information can then be used to create ToUnicode CMaps which are attachedto the Font (or CIDFont) objects embedded in the PDF file.
Fonts which have ToUnicode CMaps can be reliably (limited by the accuracy ofthe CMap) used in search and copy/paste functions, as well as text extractionfrom PDF files. Note that OCR is not a 100% perfect process; it is possiblethat some text might be misidentified.
OCR is a slow operation! In addition it can (for Latin text at least) sometimesbe preferable not to add ToUnicode information which may be incorrect, but insteadto use the existing font Encoding. For English text this may give better results.
For these reasons the OCR functionality of pdfwrite can be controlled by using a newparameter -sUseOCR
. This has three possible values;
-sUseOCR=
string- Never
- Default - don't use OCR at all even if support is built-in.
- AsNeeded
- If there is no existing ToUnicode information, use OCR.
- Always
- Ignore any existing information and always use OCR.
High-level devices
PDF writer
The pdfwrite
device outputs PDF.
PS2 writer
The ps2write
device outputs postscript language level 2.It is recommnded that this device is used for PostScript output.There is no longer any support for creating PostScript level 1 output.
EPS writer
The eps2write
device outputs encapsulated postscript.
PXL
The pxlmono
and pxlcolor
devices output HP PCL-XL,a graphic language understood by many recent laser printers.
Text output
The txtwrite device will output the text contained in the originaldocument as Unicode.
Please refer toVectorDevices.htm for documentation on thedevice options for these devices.
Display Devices
Ghostscript is often used for screen display of postscript and pdf documents.In many cases, a client or 'viewer' application calls the Ghostscript engineto do the rasterization and handles the display of the resulting image itself,but it is also possible to invoke Ghostscript directly and select an outputdevice which directly handles displaying the image on screen.
This section describes the various display-oriented devices that are availablein Ghostscript.
X Window System
Perhaps the most common use of of a display device is with the X Window Systemon unix-like systems. It is the default device on the command line client onsuch systems, and is used more creatively by the gv client application.
The available devices are:
- x11
- This is the default device, handling display on X11R6.
- x11alpha
- This is the
x11
device, but with antialiasing. It is equivalent toinvoking thex11
device with the options-dGraphicsAlphaBits=4-dTextAlphaBits=4 -dMaxBitmap=50000000
. - x11cmyk
- This device rasterizes the image in the CMYK color space, then flattensit to RGB for display. It's intended for testing only.
- x11mono
- This is a strict black-and-white device for 1-bit monochrome displays.
- x11gray2
- This is a device for 2 bpp (4-level) monochrome displays.
- x11gray4
- This is a device for 4 bpp (16-level) monochrome displays.
On Mac OS X as of 10.6, the X server (XQuartz) only supports color depth15 and 24. Depth 15 isn't well-tested, and it may be desirable, for serioususe, to switch to depth 24 with:
defaults write org.x.X11 depth 24
display device (MS Windows, OS/2, gtk+)
The display
device is used by the MS Windows,OS/2 and the gtk+ versions of ghostscript.
Options
The display device has several user settable options.
-dDisplayFormat=
N (integer bit-field)- native (1), gray (2), RGB (4), CMYK (8), or separation (80000)color spaces.
- unused first byte (40) or last byte (80).
- 1 (100), 4 (400), or 8 (800) bits/component.
- bigendian (00000 = RGB) or littleendian (10000 = BGR) order.
- top first (20000) or bottom first (00000) raster.
- 16 bits/pixel with 555 (00000) or 565 (40000) bitfields.
For more details, see the GhostscriptInterpreter API.
-dDisplayResolution=
DPI-rDPI
.When using the separation color space, the following options may be setusing setpagedevice, as described in the PostScript Language Reference:
SeparationColorNames
- An array giving the names of the spot colors
SeparationOrder
- An array giving the names and order of the colorants to be output.
IJS - Inkjet and other raster devices
IJS is a relatively new initiative to improve the quality and ease ofuse of inkjet printing with Ghostscript. Using IJS, you can add newdrivers, or upgrade existing ones, without recompiling Ghostscript.All driver authors are encouraged to adapt their drivers for IJS, andif there is an IJS driver available for your printer, it should beyour first choice.
Please see the IJS webpage for more information about IJS, including a listing ofIJS-compatible drivers.
A typical command line for IJS is:
gs -dSAFER -sDEVICE=ijs -sIjsServer=hpijs -sDeviceManufacturer=HEWLETT-PACKARD -sDeviceModel='DESKJET 990' -dIjsUseOutputFD -sOutputFile=/dev/usb/lp1 -dNOPAUSE -- examples/tiger.eps
Individual IJS command line parameters are as follows:
-sIjsServer=
{path}- Sets the pathname for the IJS server (ie printer driver).Ghostscript will spawn a new process for this driver, and communicatewith it using the IJS protocol. The pathname need not be absolute,as the PATH environment variable is searched, but it's probably a goodidea for robustness and security. Note also that if -dSAFER is notspecified, it's possible for PostScript code to set this parameter,so it can cause arbitrary code to be executed. See the section on Security for more information.
-sDeviceManufacturer=
{name}-sDeviceModel=
{name}- These parameters select the device according to IEEE-1284 standarddevice ID strings. In general, consult the documentation for thedriver to find the appropriate settings. Note that, if the valuecontains a space, you'll want to quote the value in your shell, asin the example above.
-sIjsParams=
{params}- This parameter allows you to set arbitrary IJS parameters onthe IJS driver. The format is a comma-separated list of
key=value
pairs. If it is necessary to send avalue containing a comma or backslash, it can be escaped witha backslash. Thus,'-sIjsParams=Foo=bar,Baz=a,b'
setsthe parameter Foo to 'bar', and Baz to 'a,b'.
-dIjsUseOutputFD
- This flag indicates that Ghostscript should open the output fileand pass a file descriptor to the server. If not set, Ghostscriptsimply passes the filename set in OutputFile to the server. In mostcases, this flag won't matter, but if you have a driver which worksonly with OutputFD (such as hpijs 1.0.2), or if you're using the-sOutputFile=' cmd' syntax, you'll need to set it.
-dBitsPerSample=
N- This parameter controls the number of bits per sample. Thedefault value of 8 should be appropriate for most work. For monochromeimages, use -dBitsPerSample=1.
Generic Ghostscript options that are particularly relevant for IJSare summarized below:
-r
number- 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)preferred by the IJS server.
-r
number1x
number2-dDuplex
-dTumble
- These flags enable duplex (two-sided) printing. Tumble controlsthe orientation. When Tumble is false, the pagesare oriented suitably at the left or right. When Tumble is true,the pages are oriented suitably for binding at the top orbottom.
-sProcessColorModel=
{name}- Use this flag to select the process color model. Suitable valuesinclude DeviceGray, DeviceRGB, and DeviceCMYK.
Building IJS
IJS is included by default on Unix gcc builds, and also inautoconf'ed builds. Others may need some makefile tweaking. First,make sure the IJS device is selected:
DEVICE_DEVS2=$(DD)ijs.dev
Next, make sure that the path and execution type are set inthe top level makefile. The values for Unix are as follows:
IJSSRCDIR=ijsIJSEXECTYPE=unix
At present, 'unix' and 'win' are the only supported values forIJSEXECTYPE. If neither sounds appropriate for your system, it'spossible that more porting work is needed.
Last, make sure that ijs.mak is included in the top level makefile.It should be present right after the include of icclib.mak.
IJS is not inherently platform-specific. We're very much interestedin taking patches from people who have ported it to non-mainstreamplatforms. And once it's built, you won't have to recompile Ghostscriptto support new drivers!
Rinkj - Resplendent inkjet driver
The Rinkj driver is an experimental new driver, capable of drivingsome Epson printers at a very high level of quality. It is notcurrently recommended for the faint of heart.
You will need to add the following line to your makefile:
DEVICE_DEVS2=$(DD)rinkj.dev
Most of the configuration parameters, including resolution, choiceof printer model, and linearization curves, are in a separate setupfile. In addition, we rely heavily on an ICC profile for mappingdocument colors to actual device colors.
A typical command line invocation is:
gs -r1440x720 -sDEVICE=rinkj -sOutputFile=/dev/usb/lp0 -sSetupFile=lib/rinkj-2200-setup -sProfileOut=2200-cmyk.icm -dNOPAUSE -dBATCH file.ps
Individual Rinkj command line parameters are as follows:
-sSetupFile=
{path}- Specifies the path for the setup file.
-sProfileOut=
{path}- Specifies the path for the output ICC profile. This profile shouldbe a link profile, mapping the ProcessColorModel (DeviceCMYK bydefault) to the device color space.
For 6- and 7-color devices, the target color space for the outputprofile is currently a 4-component space. The conversion from thisinto the 6- or 7-color space (the 'ink split') is done by lookuptables in the setup file.
Setup files are in a simple 'Key: value' text format. Relevant keysare:
Manufacturer:
{name}Model:
{name}- The manufacturer and model of the individual device, using thesame syntax as IEEE printer identification strings. Currently, theonly supported manufacturer string is 'EPSON', and the only supportedmodel strings are 'Stylus Photo 2200' and 'Stylus Photo 7600'.
Resolution:
{x-dpi}x{y-dpi}- The resolution in dpi. Usually, this should match theGhostscript resolution set with the
-r
switch. Otherwise,the page image will be scaled. Dither:
{int}- Selects among variant dither options. Currently, the choices are
1
for one-bit dither, and2
, for a 2-bit variabledot dither. Aspect:
{int}- Controls the aspect ratio for highlight dot placement. Validvalues are
1
,2
, and4
. For best results,choose a value near the x resolution divided by the y resolution. Forexample, if resolution is 1440x720, aspect should be 2. Microdot:
{int}- Chooses a microdot size. On EPSON devices, this value is passeddirectly through to the 'ESC ( e' command. See EPSON documentationfor further details (see, I told you this wasn't for thefaint of heart).
Unidirectional:
{int}- Enables (1) or disables (0) unidirectional printing, which isslower but possibly higher quality.
AddLut:
{plane}- Adds a linearization look-up table. The plane is one of'CcMmYKk'. The lookup table data follows. The line immediatelyfollowing AddLut is the number of data points. Then, for each datapoint is a line consisting of two space-separated floats - the outputvalue and the input value. If more than one LUT is specified for asingle plane, they are applied in sequence.
A typical setup file is supplied in lib/rinkj-2200-setup
.It is configured for the 2200, but can be adapted to the 7600 just bychanging the 'Model' line.
A known issue with this driver is poor support for margins andpage size. In some cases, this will cause an additional page to beejected at the end of a job. You may be able to work around this bysupplying a cut-down value for -dDEVICEHEIGHTPOINTS
, forexample 755 for an 8.5x11 inch page on the EPSON 2200.
HP Deskjet official drivers
HP provides official drivers for many of their Deskjet printer models.In order to use these drivers, you will need the HP Inkjet Server aswell as Ghostscript, available from http://hpinkjet.sourceforge.net.This version of Ghostscript includes the patch from version 0.97 ofthe hpijs software. If you are installing hpijs from an RPM, you willonly need the hpijs RPM, not the Ghostscript-hpijs one, as the codeneeded to work with hpijs is already included.
Note that newer version of the hpijs drivers support the IJS protocol.If you can, you should consider using the ijs driver instead. Amongother things, the hpijs Ghostscript driver is Unix-only, and is untestedon older Unix platforms.
As of the 0.97 version, hpijs supports the following printer models:
- e-Series:
- e-20
- DeskJet 350C Series:
- 350C
- DeskJet 600C Series:
- 600C, 660C, 670/672C, 670TV, 680/682C
- DeskJet 600C Series Photo:
- 610/612C, 640/648C, 690/692/693/694/695/697C
- DeskJet 630C Series:
- 630/632C
- DeskJet 800C Series:
- 810/812C, 830/832C, 840/842/843C, 880/882C, 895C
- DeskJet 900C Series, PhotoSmart::
- 930/932C, 950/952C, 970C, PhotoSmart 1000/1100
- DeskJet 990C, PhotoSmart:
- 960C, 980C, 990C, PhotoSmart 1215/1218
You will need to add the following line to your makefile:
DEVICE_DEVS2=$(DD)DJ630.dev $(DD)DJ6xx.dev $(DD)DJ6xxP.dev $(DD)DJ8xx.dev $(DD)DJ9xx.dev $(DD)DJ9xxVIP.dev $(DD)AP21xx.dev
Please see http://hpinkjet.sourceforge.netfor more information about this driver. Thanks to the folks at HP,especially David Suffield for making this driver available and working tointegrate it with Ghostscript.
Gimp-Print driver collection
The Gimp-Print project provides a large collection of printer driverswith an IJS interface. Please see theirwebsitefor details.
MS Windows printers
This section was written by Russell Lang, the author of Ghostscript'sMS Windows-specific printer driver, and updated byPierre Arnaud,the current maintainer.
The mswinpr2
device uses MS Windows printer drivers, andthus should work with any printer with device-independent bitmap (DIB)raster capabilities. The printer resolution cannot be selected directlyusing PostScript commands from Ghostscript: use the printer setup in theControl Panel instead. It is however possible to specify a maximum resolutionfor the printed document (see below).
If no Windows printer name is specified in -sOutputFile
,Ghostscript prompts for a Windows printer using the standard Print Setupdialog box. You must set the orientation to Portrait and the page size tothat expected by Ghostscript; otherwise the image will be clipped.Ghostscript sets the physical device size to that of the Windows printerdriver, but it does not update the PostScript clipping path.
If a Windows printer name is specified in -sOutputFile
usingthe format '%printer%printer_name'
, for instance
gs ... -sOutputFile='%printer%Apple LaserWriter II NT'
then Ghostscript attempts to open the Windows printer without prompting(except, of course, if the printer is connected to FILE:
).Ghostscript attempts to set the Windows printer page size and orientationto match that expected by Ghostscript, but doesn't always succeed. It usesthis algorithm:
- If the requested page size matches one of the Windows standard pagesizes +/- 2mm, request that standard size.
- Otherwise if the requested page size matches one of the Windowsstandard page sizes in landscape mode, ask for that standard size inlandscape.
- Otherwise ask for the page size by specifying only its dimensions.
- Merge the requests above with the defaults. If the printer driverignores the requested paper size, no error is generated: it will print onthe wrong paper size.
- Open the Windows printer with the merged orientation and size.
The Ghostscript physical device size is updated to match the Windowsprinter physical device.
Supported command-line parameters
The mswinpr2
device supports a limited number of command-lineparameters (e.g. it does not support setting the printer resolution). Therecognized parameters are the following:
-sDEVICE=mswinpr2
- Selects the MS Windows printer device. If Ghostscript was notcompiled with this device as the default output device, you have to specifyit on the command line.
-dNoCancel
- Hides the progress dialog, which shows the percent of the document pagealready processed and also provides a cancel button. This optionis useful if GS is intended to print pages in the background, without anyuser intervention.
-sOutputFile=
'%printer%printer_name'- Specifies which printer should be used. The printer_name should betyped exactly as it appears in the Printers control panel, including spaces.
Supported options (device properties)
Several extra options exist which cannot be set through the command-line,but only by executing the appropriate PostScript setup code. These optionscan be set through the inclusion of a setup file on the command-line:
gs ... setup.ps ...
The setup.ps
file is responsible for the device selection, thereforeyou should not specify the -sDEVICE=mswinpr2
option on thecommand-line if you are using such a setup file. Here is an example of sucha setup file:
This example disables the progress dialog (same as the -dNoCancel
option), forces a 4 bits/pixel output resolution and specifies additional usersettings, such as the document name (which will be displayed by the Windowsspooler for the queued document) and the maximum resolution (here 360 dpi).It then finds and selects an instance of the MS Windows device printerand activates it. This will show the standard printer dialog, since no/OutputFile
property was specified.
The following options are available:
/NoCancel boolean
- Disables (hides) the progress dialog when set to
true
orshow the progress dialog if not set or set tofalse
./OutputFile string
- Specifies which printer should be used. The string should be of the form
%printer%printer_name
, where the printer_name should betyped exactly as it appears in the Printers control panel, including spaces./QueryUser integer
- Shows the standard printer dialog (
1
or any other value),shows the printer setup dialog (2
) or selects thedefault Windows printer without any user interaction (3
)./BitsPerPixel integer
- Sets the device depth to the specified bits per pixel. Currently supportedvalues are
1
(monochrome),4
(CMYK with screeninghandled by Ghostscript) and24
(True Color, dithering handled bythe Windows printer driver; this option can produce huge print jobs)./UserSettings dict
- Sets additional options, defined in a dictionary. The following properties canbe set:
/DocumentName string
- Defines the user friendly document name which will be displayed by theWindows spooler.
/DocumentRange [n1 n2]
- Defines the range of pages contained in the document. This information canbe used by the printer dialog, in conjunction with the following property.
/SelectedRange [n1 n2]
- Defines the selected range of pages. This information will be displayed inthe printer dialog and will be updated after the user interaction. A PostScriptprogram could check these values and print only the selected page range.
/MaxResolution dpi
- Specifies the maximum tolerated output resolution. If the selected printer hasa higher resolution than
dpi
, then Ghostscript will render thedocument with a submultiple of the printer resolution. For example, ifMaxResolution
is set to 360 and the output printer supportsup to 1200 dpi, then Ghostscript renders the document with an internalresolution of 1200/4=300 dpi. This can be very useful to reduce the memoryrequirements when printing in True Color on some high resolution ink-jet colorprinters.
These properties can be queried through the currentpagedevice
operator. The following PostScript code snippet shows how to do it for someof the properties:
There are a few undocumented parameters stored in the UserSettings
dictionary. You should not rely on them. Their use is still experimental andthey could be removed in a future version.
Duplex printing
If the Windows printer supports the duplex printing feature, then it willalso be available through the mswinpr2
device. You can queryfor this support through the /Duplex
property of thecurrentpagedevice
. If it returns null
, thenthe feature is not supported by the selected printer. Otherwise, true
means that the printer is currently set up to print on both faces of the paperand false
that it is not, but that it can.
The following example shows how to print on both faces of the paper (usingthe long side of the paper as the reference):
Sun SPARCprinter
This section was contributed by Martin Schulte.
With a SPARCprinter you always buy software that enables you to doPostScript printing on it. A page image is composed on the host, whichsends a bitmap to the SPARCprinter through a special SBUS video interface.So the need for a Ghostscript interface to the SPARCPrinter seems low, buton the other hand, Sun's software prints some PostScript drawingsincorrectly: some pages contain a thin vertical line of rubbish, and onsome Mathematica drawings the text at the axes isn't rotated. Ghostscript,however, gives the correct results. Moreover, replacing proprietarysoftware should never be a bad idea.
The problem is that there has yet been no effort to make the SPARCPrinterdriver behave like a BSD output filter. I made my tests using the scriptshown here.
Installation
Add sparc.dev
to DEVICE_DEVS
and compileGhostscript as described in the documentation on how tobuild Ghostscript. Afterwards you can use the following script as anexample for printing after modifying it with the right pathnames --including for {GSPATH} the full pathname of the Ghostscriptexecutable:
Problems
Since /dev/lpi
can be opened only for exclusive use, ifanother job has it open (engine_ctl_sparc or another Ghostscript are themost likely candidates), Ghostscript stops with 'Error: /invalidfileaccessin --.outputpage--'
In case of common printer problems like being out of paper, a warningdescribing the reason is printed to stdout. The driver tries access againeach five seconds. Due to a problem with the device driver (in the kernel)the reason for printer failure isn't always reported correctly to theprogram. This is the case, for instance, if you open the top cover (errorE5 on the printer's display). Look at the display on the printer itself ifa 'Printer problem with unknown reason' is reported. Fatal errors causethe print job to be terminated.
Note: there is some confusion whether the resolution setting should bethe integers 300 and 400, or the symbolic constants DPI300 and DPI400(defined in lpviio.h). Ghostscript releases have had it both ways. Itis currently the latter. However, INOUE Namihiko reports (in bug#215256)that the former works better for him. If anyonehas a definitive answer, please let us know.
Apple dot matrix printer
This section was contributed by Mark Wedel<master@cats.ucsc.edu>.
The Apple Dot Matrix Printer (DMP) was a parallel predecessor to theImagewriter printer. As far as I know, Imagewriter commands are a supersetof the Dot Matrix printer's, so the driver should generate output that canbe printed on Imagewriters.
To print images, the driver sets the printer for unidirectional printingand 15 characters per inch (cpi), or 120dpi. It sets the line feed to 1/9inch. When finished, it sets the printer to bidirectional printing,1/8-inch line feeds, and 12 cpi. There appears to be no way to reset theprinter to initial values.
This code does not set for 8-bit characters (which is required). It alsoassumes that carriage return-newline is needed, and not just carriagereturn. These are all switch settings on the DMP, and I have configuredthem for 8-bit data and carriage return exclusively. Ensure that the Unixprinter daemon handles 8-bit (binary) data properly; in my SunOS 4.1.1printcap
file the string 'ms=pass8,-opost
'works fine for this.
Finally, you can search devdemp.c
for'Init
' and 'Reset
' to find the strings thatinitialize the printer and reset things when finished, and change them tomeet your needs.
Special and Test devices
The devices in this section are intended primarily for testing. They maybe interesting as code examples, as well.
Raw 'bit' devices
There are a collection of 'bit' devices that don't do any special formattingbut output 'raw' binary data for the page images. These are used for benchmarkingbut can also be useful when you want to directly access the raster data.
The raw devices are bit bitrgb bitcmyk
.
Train Tumble Mac Os X
Bounding box output
There is a special bbox
'device' that just prints thebounding box of each page. You select it in the usual way:
gs -dSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox
It prints the output in a format like this:
Train Tumble Mac Os Download
Currently, it always prints the bounding box on stderr
;eventually, it should also recognize -sOutputFile=
.
By default, white objects don't contribute to the bounding box becausemany files fill the whole page with white before drawing other objects.This can be changed by:
Train Tumble Mac Os Catalina
<< /WhiteIsOpaque true >> setpagedevice
Note that this device, like other devices, has a resolution and a (maximum)page size. As for other devices, the product (resolution x page size) islimited to approximately 500K pixels. By default, the resolution is 4000DPI and the maximum page size is approximately 125', or approximately 9000default (1/72') user coordinate units. If you need to measure larger pagesthan this, you must reset both the resolution and the page size inpixels, e.g.,
gs -dNOPAUSE -dBATCH -sDEVICE=bbox -r100 -g500000x500000
Train Tumble Mac Os 11
Ink coverage output
There are two special inkcov
devices that print theink coverage of each page; the inkcov device and the ink_cov device.They are selected like this:
These commands also work as expected:
The devices print their output in a format like this:
The difference between the two devices is that the inkcov device considers each rendered pixel and whetherit marks the C, M, Y or K channels. So the percentages are a measure of how many device pixelscontain that ink. The ink_cov device gives the more traditional use of ink coverage, italso considers the amount of each colourant at each rendered pixel, so the percentages in thiscase are what percentage of the ink is used on the page.
As an example, If we take a page which is covered by a pure 100% cyan fill both devices would givethe same result 1.00 0.00 0.00 0.00; each pixel is marked by the cyan ink and each pixel contains 100% cyan.If however we use a 50% cyan fill the inkcov device will still give 1.00 0.00 0.00 0.00 as 100% of the pixels contain cyan. Theink_cov device, however, would give a result of 0.50 0.00 0.00 0.00.
Permutation (DeviceN color model)
With no additional parameters, the device named 'permute' looksto Ghostscript like a standard CMYK contone device, and outputs aPPM file, using a simple CMYK->RGB transform. This should be thebaseline for regression testing.
With the addition of -dPermute=1
, the internal behavior changessomewhat, but in most cases the resulting rendered file should be thesame. In this mode, the color model becomes 'DeviceN' rather than'DeviceCMYK', the number of components goes to six, and the colormodel is considered to be the (yellow, cyan, cyan, magenta, 0, black)tuple. This is what's rendered into the memory buffer. Finally, onconversion to RGB for output, the colors are permuted back.
As such, this code should check that all imaging code paths are64-bit clean. Additionally, it should find incorrect code that assumesthat the color model is one of DeviceGray, DeviceRGB, or DeviceCMYK.
Currently, the code has the limitation of 8-bit continuous tonerendering only. An enhancement to do halftones is planned as well. Note,however, that when testing permuted halftones for consistency, it isimportant to permute the planes of the default halftone accordingly, andthat any file which sets halftones explicitly will fail a consistencycheck.
spotcmyk (DeviceN color model)
The spotcmyk
device was created for debugging and testing of the DeviceNextensions to Ghostscript that were released in version 8.0.There are also another device (devicen
) in the samesource file. It were created for testing however it are not actually usefulexcept as example code.
The spotcmyk
device was also designed to provide example code for adevice which supports spot colors.Spot colors need to be specified prior to opening thefirst page.This can be done via adding thefollowing to the command line: -c '<< /SeparationColorNames [ /Name1 /Name2 ]>> setpagedevice' -f
.
The spotcmyk
device produces a binary data file (similar to the bitcmykdevice) for the CMYK data. This data file has the name specified by the 'OutputFile'parameter.The device also produces a binary data file (similar to the bitmono device)for each spot color plane.These data files have the name specified by the 'OutputFile'parameter with 'sn' appended to the end (where 'n' is the spot color number 0 to 12)'.
After the spotcmyk
device produces the binary data files, the files are readand PCX format versions of these files are created with '.pcx' appended to the binarysource file name.
If the the spotcmyk
is being used with three spot colors and the'OutputFile' parameter is xxx
then the following files would be createdby the device:
The spotcmyk
device has the creation of the binary data files separatedfrom the creation of the PCX files since the source file is intended as examplecode and many people may not be interested in the PCX format. The PCX format waschosen because it was simple to implement from preexisting code and viewers areavailable. The PCX format does have the disadvantage that most of those viewersare on Windows.
XCF (DeviceN color model)
The XCF file format is the native image format for the GIMP program. This formatis currently supported by two devices: xcfrgb
and xcfcmyk
.
We have been warned by the people supporting the GIMP program that they reservethe right to change theXCF format at anytime and thus these devices may become invalid. They are beingincluded in the documentation because we have received some questions aboutthese devices do.
The XCF devices were created for testing of the DeviceN extensions to Ghostscriptwhich were released in version 8.0.
The xcfrgb
device uses a DeviceRGB process color model and createsa normal XCF file.
The xcfcmyk
device was created as a means of viewing spot colors forthose users that do not have access to either Photoshop (see the PSDdevices) or a PCX viewer (see the spotcmyk
device).
The xcfcmyk
device starts by using a DeviceCMYK process color model. TheDeviceCMYK process color model allows the xcfcmyk
device to alsosupport spot colors. Spot colors need to be specified prior to opening thefirst page.This can be done via adding thefollowing to the command line: -c '<< /SeparationColorNames [ /Name1 /Name2 ]>> setpagedevice' -f
.
After a page is complete, the xcfcmyk
converts the CMYK image data intoRGB for storing in the XCF output file. The XCF format does not currentlysupport CMYK data directly. The spot color planes are converted into alphachannel planes. This is done because the XCF format does not currently supportspot colors.
Copyright © 2000-2021 Artifex Software, Inc. All rights reserved.
This software is provided AS-IS with no warranty, either express orimplied.This software is distributed under license and may not be copied, modifiedor distributed except as expressly authorized under the terms of thatlicense. Refer to licensing information at https://www.artifex.comor contact Artifex Software, Inc., 1305 Grant Avenue - Suite 200,Novato, CA 94945, U.S.A., +1(415)492-9861, for further information.
Ghostscript version 9.54.0, 30 March 2021