Skip to content
Back to formatted view

Raw Message

Message-ID: <20020808090417.GA10352@pc34.maths.bris.ac.uk>
Date: 2002-08-08T09:04:18Z
From: Zoltan Barta
Subject: R graphics and dpi
In-Reply-To: <Pine.GSO.4.10.10208072229140.27805-100000@quetelet.stat.ucla.edu>

Dear Roger,

On Wed, Aug 07, 2002 at 10:30:59PM -0700, Roger Peng wrote:
> Is there a way to tell at what dpi R generates graphics at?   I need to
> generate 600 dpi graphics for an article.

I would generate the graphics in eps then convert it with ghostscript. The
attached shell script can give some hints about this.

Zoltan

-- 

Zoltan BARTA
Z.Barta at bristol.ac.uk
http://delfin.klte.hu/~zbarta/
-------------- next part --------------
#! /bin/bash 

# convert .eps files to .tif files using ghostscript

b_nev=$1;
for f in "$b_nev"*.eps; do
    bf=`basename $f .eps`;
    echo -n Processing: $bf;
    infile=$bf.eps;
    outfile=$bf.tif;

# this gives the bounding box
    BB=`gs -dBATCH -dNOPAUSE -sDEVICE=bbox $infile 2>&1 | grep '^..B'`;
    echo -n ...;

# this set the paper size
    width=`echo "$BB"|awk '{print $4}'`;
    height=`echo "$BB"|awk '{print $5}'`;
    echo "width: $width, height: $height";

# this does the transformation
    gs -dBATCH -dNOPAUSE -dDEVICEWIDTHPOINTS=$width \
	-dDEVICEHEIGHTPOINTS=$height -sDEVICE=tiffg4 \
	-sOutputFile=$outfile -r600x600 $infile > /dev/null;
    echo done.
done