[R-SIG-Mac] tiff does not seem to respect resolution & compression

Andrew Steen andrew.decker.steen at gmail.com
Mon May 27 04:46:03 CEST 2013


Running R 3.0.0 on Mac OSX 10.7.5, tiff() does not seem to respect the
res and compression arguments. For example,

x <- rnorm(1000)
tiff("nocompress.tif", height=6, width=6, res=200, units="in")
hist(x)
dev.off()

yields a file of 5.8 MB.

tiff("compress.tif", height=6, width=6, res=200, units="in", compression="lzw")
hist(x)
dev.off()

also yields a file of 5.8 MB (which seems very large for a 6in x 6in,
black-and-white lzw compressed image!) Furthermore, Photoshop seems to
think that it is a 16.67 x 16.67 inch image at 72 ppi, as if tiff is
calculating the number of pixels correctly but not setting some kind
of image attribute for size.

A Stack Overflow user describes a similar problem at
http://stackoverflow.com/questions/12609816/r-tiff-wont-compress-or-set-resolution-to-300-ppi.
That thread shows that the issue crops up on several R releases and
versions of OSX, but I can't find anyone who has diagnosed the problem
or identified a solution.

Thanks,
Drew



More information about the R-SIG-Mac mailing list