The Encapsulated PostScript (EPS) format is commonly used to store images (or individual/single-page parts of a document) in the PostScript documents. For a more complete introduction, please see Recognized file formats. To provide high quality graphics, the Postscript language is a vectorized format, therefore pixels (elements of a “rasterized” format) aren’t defined in their context.
To display rasterized images, PostScript does allow arrays of
pixels. However, since the over-all EPS file may contain many vectorized
elements (for example borders, text, or other lines over the text) and
interpreting them is not trivial or necessary within Gnuastro’s scope,
Gnuastro only provides some functions to write a dataset (in the
gal_data_t format, see Generic data container (
gal_data_t)) into EPS.
name has an EPS suffix. This can be used to make
sure that a given input file is EPS. See
gal_eps_suffix_is_eps for a
list of recognized suffixes.
suffix is a recognized EPS suffix. The recognized
Given a specific width in centimeters (
widthincm and the number of
the dataset’s pixels in each dimension (
dsize) calculate the size of
the output in PostScript points. The output values are written in the
w_h_in_pt array (which has to be allocated before calling this
function). The first element in
w_h_in_pt is the width and the
second is the height of the image.
in dataset into an EPS file called
in has to be an unsigned 8-bit character type
GAL_TYPE_UINT8, see Numeric data types). The desired width of
the image in human/non-pixel units (to help the displayer) can be set with
widthincm argument. If
borderwidth is non-zero, it is
interpreted as the width (in points) of a solid black border around the
image. A border can helpful when importing the EPS file into a document.
EPS files are plain-text (can be opened/edited in a text editor), therefore
there are different encodings to store the data (pixel values) within
them. Gnuastro supports the Hexadecimal and ASCII85 encoding. ASCII85 is
more efficient (producing small file sizes), so it is the default
encoding. To use Hexadecimal encoding, set
hex to a non-zero
value. Currently If you don’t directly want to import the EPS file into a
PostScript document but want to later compile it into a PDF file, set the
forpdf argument to
By default, when the dataset only has two values, this function will use the PostScript optimization that allows setting the pixel values per bit, not byte (Recognized file formats). This can greatly help reduce the file size. However, when dontoptimize!=0, this optimization is disabled: even though there are only two values (is binary), the difference between them does not correspond to the full contrast of black and white.