EVOLUTION-MANAGER
Edit File: dev2bitmap.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Graphics Device for Bitmap Files via Ghostscript</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for dev2bitmap {grDevices}"><tr><td>dev2bitmap {grDevices}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Graphics Device for Bitmap Files via Ghostscript</h2> <h3>Description</h3> <p><code>bitmap</code> generates a graphics file. <code>dev2bitmap</code> copies the current graphics device to a file in a graphics format. </p> <h3>Usage</h3> <pre> bitmap(file, type = "png16m", height = 7, width = 7, res = 72, units = "in", pointsize, taa = NA, gaa = NA, ...) dev2bitmap(file, type = "png16m", height = 7, width = 7, res = 72, units = "in", pointsize, ..., method = c("postscript", "pdf"), taa = NA, gaa = NA) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>file</code></td> <td> <p>The output file name, with an appropriate extension.</p> </td></tr> <tr valign="top"><td><code>type</code></td> <td> <p>The type of bitmap.</p> </td></tr> <tr valign="top"><td><code>width, height</code></td> <td> <p>Dimensions of the display region.</p> </td></tr> <tr valign="top"><td><code>res</code></td> <td> <p>Resolution, in dots per inch.</p> </td></tr> <tr valign="top"><td><code>units</code></td> <td> <p>The units in which <code>height</code> and <code>width</code> are given. Can be <code>in</code> (inches), <code>px</code> (pixels), <code>cm</code> or <code>mm</code>.</p> </td></tr> <tr valign="top"><td><code>pointsize</code></td> <td> <p>The pointsize to be used for text: defaults to something reasonable given the width and height</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Other parameters passed to <code><a href="postscript.html">postscript</a></code> or <code><a href="pdf.html">pdf</a></code>.</p> </td></tr> <tr valign="top"><td><code>method</code></td> <td> <p>Should the plot be done by <code><a href="postscript.html">postscript</a></code> or <code><a href="pdf.html">pdf</a></code>?</p> </td></tr> <tr valign="top"><td><code>taa, gaa</code></td> <td> <p>Number of bits of antialiasing for text and for graphics respectively. Usually 4 (for best effect) or 2. Not supported on all types.</p> </td></tr> </table> <h3>Details</h3> <p><code>dev2bitmap</code> works by copying the current device to a <code><a href="postscript.html">postscript</a></code> or <code><a href="pdf.html">pdf</a></code> device, and post-processing the output file using <code>ghostscript</code>. <code>bitmap</code> works in the same way using a <code>postscript</code> device and post-processing the output as ‘printing’. </p> <p>You will need <code>ghostscript</code>: the full path to the executable can be set by the environment variable <span class="env">R_GSCMD</span>. If this is unset, a GhostScript executable will be looked for by name on your path: on a Unix alike <code>"gs"</code> is used, and on Windows the setting of the environment variable <span class="env">GSC</span> is used, otherwise commands <code>"gswi64c.exe"</code> then <code>"gswin32c.exe"</code> are tried. </p> <p>The types available will depend on the version of <code>ghostscript</code>, but are likely to include <code>"jpeg"</code>, <code>"jpegcmyk"</code>, <code>"jpeggray"</code>, <code>"tiffcrle"</code>, <code>"tiffg3"</code>, <code>"tiffg32d"</code>, <code>"tiffg4"</code>, <code>"tiffgray"</code>, <code>"tifflzw"</code>, <code>"tiffpack"</code>, <code>"tiff12nc"</code>, <code>"tiff24nc"</code>, <code>"tiff32nc"</code> <code>"png16"</code>, <code>"png16m"</code>, <code>"png256"</code>, <code>"png48"</code>, <code>"pngmono"</code>, <code>"pnggray"</code>, <code>"pngalpha"</code>, <code>"bmp16"</code>, <code>"bmp16m"</code> <code>"bmp256"</code>, <code>"bmp32b"</code>, <code>"bmpgray"</code>, <code>"bmpmono"</code>. </p> <p>The default type, <code>"png16m"</code>, supports 24-bit colour and anti-aliasing. Type <code>"png256"</code> uses a palette of 256 colours and could give a more compact representation. Monochrome graphs can use <code>"pngmono"</code>, or <code>"pnggray"</code> if anti-aliasing is desired. Plots with a transparent background and varying degrees of transparency should use <code>"pngalpha"</code>. </p> <p>Note that for a colour TIFF image you probably want <code>"tiff24nc"</code>, which is 8-bit per channel RGB (the most common TIFF format). None of the listed TIFF types support transparency. <code>"tiff32nc"</code> uses 8-bit per channel CMYK, which printers might require. </p> <p>For formats which contain a single image, a file specification like <code>Rplots%03d.png</code> can be used: this is interpreted by Ghostscript. </p> <p>For <code>dev2bitmap</code> if just one of <code>width</code> and <code>height</code> is specified, the other is chosen to preserve the aspect ratio of the device being copied. The main reason to prefer <code>method = "pdf"</code> over the default would be to allow semi-transparent colours to be used. </p> <p>For graphics parameters such as <code>"cra"</code> that need to work in pixels, the default resolution of 72dpi is always used. </p> <p>On Windows only, paths for <code>file</code> and <span class="env">R_GSCMD</span> which contain spaces are mapped to short names <em>via</em> <code><a href="../../utils/html/shortPathName.html">shortPathName</a></code>. </p> <h3>Value</h3> <p>None. </p> <h3>Conventions</h3> <p>This section describes the implementation of the conventions for graphics devices set out in the “R Internals Manual”. These devices follow the underlying device, so when viewed at the stated <code>res</code>: </p> <ul> <li><p> The default device size is 7 inches square. </p> </li> <li><p> Font sizes are in big points. </p> </li> <li><p> The default font family is (for the standard Ghostscript setup) URW Nimbus Sans. </p> </li> <li><p> Line widths are as a multiple of 1/96 inch, with no minimum. </p> </li> <li><p> Circle of any radius are allowed. </p> </li> <li><p> Colours are interpreted by the viewing/printing application. </p> </li></ul> <h3>Note</h3> <p>On Windows, Use of <code>bitmap</code> will leave a temporary file (with file name starting <code>Rbit</code>). </p> <p>Although using <code>type = "pdfwrite"</code> will work for simple plots, it is not recommended. Either use <code><a href="pdf.html">pdf</a></code> to produce PDF directly, or call <code>ps2pdf -dAutoRotatePages=/None</code> on the output of <code><a href="postscript.html">postscript</a></code>: that command is optimized to do the conversion to PDF in ways that these functions are not. </p> <h3>See Also</h3> <p><code><a href="savePlot.html">savePlot</a></code>, which for <code>windows</code> and <code>X11(type = "cairo")</code> provides a simple way to record a PNG record of the current plot. </p> <p><code><a href="postscript.html">postscript</a></code>, <code><a href="pdf.html">pdf</a></code>, <code><a href="png.html">png</a></code>, <code><a href="png.html">jpeg</a></code>, <code><a href="png.html">tiff</a></code> and <code>bmp</code>. </p> <p>To display an array of data, see <code><a href="../../graphics/html/image.html">image</a></code>. </p> <hr /><div style="text-align: center;">[Package <em>grDevices</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>