I generated some high resolution publication quality plots for example
library(plot3D)
Volcano<-volcano
zf=10 #zoom factor
tiff("Volcano.tif", width=1800*zf, height=900*zf, res=175*zf, compression="lzw")
image2D(z = Volcano, clab = "height, m",colkey = list(dist = -0.20, shift = 0.15,side = 3, length = 0.5, width = 0.5,cex.clab = 1.2, col.clab = "white", line.clab = 2,col.axis = "white", col.ticks = "white", cex.axis = 0.8))
dev.off()
the file is 22 MB.
Now I open the file with GIMP and without doing anything else I export it as "Volcano gimp.tif" (don't change resolution, or do anything else). GIMP generates a file ("Volcano gimp.tif") that is 1.9 MB.
imagemagick
reports similar image stats:
$ identify Volcano.tif
Volcano.tif TIFF 18000x9000 18000x9000+0+0 8-bit DirectClass 22.37MB 0.000u 0:00.000
$ identify "Volcano gimp.tif"
Volcano gimp.tif TIFF 18000x9000 18000x9000+0+0 8-bit DirectClass 1.89MB 0.000u 0:00.000
even using identify -verbose
the 2 files appear to be similar.
What is the difference between these files? Why do they have so different file sizes?
UPDATE: OK, things are getting crazier. I did the same thing with IrfanView and I get different file sizes. The initial file is the Volcano.tif
generated from R
with compression="lzw"
. Check how Volcano irfan.tif
and Volcano gimp.tif
differ in size but all other stats are the same. Memory footprint, DPI, Colors, Resolution is identical. Disk size is different.
UPDATE 2: Adobe Photoshop saves the file down to 2.6 MB
WinRar reports that the original R generated TIFF is highly compressible (from 22MB ->3.6MB)
UPDATE 3: This issue might be similar to Montage / Join 2 TIFF images in a 2 col x 1 row tile without losing quality
UPDATE 4: The R generated TIFF file can be found here http://ge.tt/7ZvRd4C1/v/0?c
See Question&Answers more detail:
os