Reputation: 1122
I am trying to save some graphs using R for publication. I want to have them compressed with lzw and have the resolution at 300. For some reason it won't allow me to do this. In fact, it seems like R is ignoring some of the variables I set.
For the code example,
tiff(file="file.tiff",
width=6.83, height=6.83, units="in",
pointsize="12", compression = "lzw",
bg="white", res=300, antialias = "none" )
outputs an uncompressed file of size 28 x 28 inches and a resolution of 72 ppi.
A reproducable example would be
hist(rnorm(1000))
dev.off()
Here is the output of ImageMagick for file.tiff
Image: file.tiff
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 2049x2049+0+0
Units: PixelsPerInch
Type: PaletteAlpha
Base type: TrueColor
Endianess: MSB
Colorspace: sRGB
...
Compression: None
...
Filesize: 16.8MB
I tested this on another Apple running 10.7 and get the same results. As can be seen, even when using the options to compress and set the resolution at 300 dpi, the output does not follow the options.
Upvotes: 2
Views: 3650
Reputation: 146
I verified your example with R 2.15.1 on GNU/Linux by appending
hist(rnorm(1000))
dev.off()
to your tiff()
call and checked the resulting file "file.tiff"
with ImageMagick's command line tool identify
(most output omitted):
Image: file.tiff
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 2049x2049+0+0
Resolution: 300x300
Print size: 6.83x6.83
[...]
Compression: LZW
[...]
Filesize: 70KB
[...]
The R command seems to do exactly what you intend to do. I suspect that either you create the TIFF file not in the manner you describe or the tool you use to check the TIFF file's properties is faulty.
Upvotes: 1