\HeaderA{dev2bitmap}{Graphics Device for Bitmap Files via GhostScript}{dev2bitmap}
\aliasA{bitmap}{dev2bitmap}{bitmap}
\keyword{utilities}{dev2bitmap}
\begin{Description}\relax
\code{bitmap} generates a graphics file.
\code{dev2bitmap} copies the current graphics device to a file in a
graphics format.
\end{Description}
\begin{Usage}
\begin{verbatim}
bitmap(file, type = "png256", height = 6, width = 6, res = 72,
       pointsize, ...)

dev2bitmap(file, type = "png256", height = 6, width = 6, res = 72,
           pointsize, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{file}] The output file name, with an appropriate extension.
\item[\code{type}] The type of bitmap. the default is \code{"png256"}.
\item[\code{height}] The plot height, in inches.
\item[\code{width}] The plot width, in inches.
\item[\code{res}] Resolution, in dots per inch.
\item[\code{pointsize}] The pointsize to be used for text: defaults to
something reasonable given the width and height
\item[\code{...}] Other parameters passed to \code{\LinkA{postscript}{postscript}}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{dev2bitmap} works by copying the current device to a
\code{\LinkA{postscript}{postscript}} device, and post-processing the output file
using \code{ghostscript}.  \code{bitmap} works in the same way using a
\code{postscript} device and postprocessing the output as
\dQuote{printing}.

You will need a version of \code{ghostscript} (5.10 and
later have been tested): the full path to the executable can be set by
the environment variable \env{R\_GSCMD}.
(If this is unset the command \code{"gs"} is used.)

The types available will depend on the version of \code{ghostscript},
but are likely to include
\code{"pcxmono"}, \code{"pcxgray"}, \code{"pcx16"}, \code{"pcx256"},
\code{"pcx24b"}, \code{"pcxcmyk"}, \code{"pbm"}, \code{"pbmraw"},
\code{"pgm"}, \code{"pgmraw"}, \code{"pgnm"}, \code{"pgnmraw"},
\code{"pnm"}, \code{"pnmraw"}, \code{"ppm"}, \code{"ppmraw"},
\code{"pkm"}, \code{"pkmraw"}, \code{"tiffcrle"}, \code{"tiffg3"},
\code{"tiffg32d"}, \code{"tiffg4"}, \code{"tifflzw"},
\code{"tiffpack"}, \code{"tiff12nc"}, \code{"tiff24nc"},
\code{"psmono"}, \code{"psgray"}, \code{"psrgb"}, \code{"bit"},
\code{"bitrgb"}, \code{"bitcmyk"}, \code{"pngmono"}, \code{"pnggray"},
\code{"png16"}, \code{"png256"}, \code{"png16m"}, \code{"jpeg"},
\code{"jpeggray"}, \code{"pdfwrite"}.

Note: despite the name of the functions they can produce PDF \emph{via}
\code{type = "pdfwrite"}, and the PDF produced is not bitmapped.

For formats which contain a single image, a file specification like
\code{Rplots\%03d.png} can be used: this is interpreted by GhostScript.

For \code{dev2bitmap} if just one of \code{width} and \code{height} is
specified, the other is chosen to preserve aspect ratio of the
device being copied.
\end{Details}
\begin{Value}
None.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{postscript}{postscript}}, \code{\LinkA{png}{png}} and
\code{\LinkA{jpeg}{jpeg}} and on Windows \code{bmp}.

\code{\LinkA{pdf}{pdf}} generate PDF directly.

To display an array of data, see \code{\LinkA{image}{image}}.
\end{SeeAlso}

