eps2raster
Convert an EPS file to a raster image file
Contents
Syntax
eps2raster(epsfile, filename, fmt) eps2raster(epsfile, outfile) eps2raster(epsfile, fmt) eps2raster(..., 'Param1', Value1, 'Param2', Value2, ...)
Description
eps2raster is a wrapper function to external Ghostscript interpreter. In order to use this function, a recent version of Ghostscript (that supports the -dEPSCrop option) must be installed on the computer. And run epssetup to specify the interpreter.
eps2raster(epsfile, filename, fmt) converts the EPS file specified by epsfile to to the file specified by filename in the format specified by fmt. filename is a string that specifies the name of the file. fmt is a string specifying the format of the file. See the table below for the supported image formats.
Supported Graphics Format |
fmt String |
File Extensions |
---|---|---|
Joint Photographic Experts Group |
JPEG |
.jpg, .jpeg |
Tagged Image File Format |
TIFF |
.tif, .tiff |
Portable Network Graphics |
PNG |
.png |
Windows Bitmat |
BMP |
.bmp |
eps2raster(epsfile, filename) outputs to filename, inferring the format to use from the filename's extension. The file extension must match one of the expected extensions listed in the table above.
eps2raster(epsfile, fmt) outputs to a file with the same file name as the epsfile but with the file extension for the format specified by fmt.
eps2raster(..., 'Param1', Value1, 'Param2', Value2,...) specifies parameters that control various characteristics of the output file. Any unspecified parameters are set to use the default value for that parameter. There are two types of parameters: common and format-specific. See the following sections for each type of parameters.
Common parameters
The following table lists the available parameters for all image formats.
Option |
Value |
Description |
---|---|---|
Resolution |
positive numeric vector {[300]} |
A two-element vector containing the XResolution and YResolution, or a scalar indicating both resolutions; the default value is 300. The units are in pixels per inch. |
Size |
one- or two-element vector of nonnegative integers |
[Width Height] of the image size in number of pixels. To keep the aspect ratio of the bounding box, use 0 for the dimension to be auto- adjusted. Alternatively, a scaler scaling factor can be specified. |
TextAlphaBits |
0, 1, 2, 3, {4} |
The number of bits for text antialiasing; The value of 4 should be given for optimum output, but smaller values can be used for faster rendering. |
GraphicsAlphaBits |
0, 1, 2, 3, {4} |
The number of bits for graphics antialiasing; The value of 4 should be given for optimum output, but smaller values can be used for faster rendering. |
EmbedICCProfile |
'on'|{'off'} |
Embed ICC color profile to the output file. |
DeleteSource |
'on'|{'off'} |
Delete source EPS file upon successful creation of the output file. |
JPEG-specific parameters
The following table lists the parameters specific to JPEG format.
Option |
Value |
Description |
---|---|---|
ColorSpace |
{'color'} | 'gray' |
  |
Quality |
an integer between |
Image quality factor: higher numbers mean quality is better (less image degradation due to compression), but the resulting file size is larger. |
TIFF-specific parameters
The following table lists the parameters specific to TIFF format.
Option |
Value |
Description |
---|---|---|
ColorSpace |
{'color'} | 'gray' | 'mono' |
  |
BitDepth |
12, {24}, 32, 48, 64 |
Only relevant for ColorSpace = 'color'. If BitDepth = 12, 24, or 48, the image is encoded in RGB space while BitDepth = 32 or 64, it results in a CMYK image. |
Compression |
'none', 'crle', 'g3', 'g4', 'lzw', {'pack'} |
  |
PNG-specific parameters
The following table lists the parameters specific to JPEG format.
Option |
Value |
Description |
---|---|---|
ColorSpace |
{'color'} | 'gray' | 'mono' |
  |
BitDepth |
4, 8, or {24} |
Only relevant for ColorSpace = 'color'. |
Transparency |
'on' or {'off'} |
Applicable only if ColorSpace = 'color' and forces BitDepth = 24. |
BMP-specific parameters
There are no BMP specific parameters.
Example
See Also
Copyright 2012. Takeshi Ikuma. All rights reserved.