jcupitt/libvips — Issue #8: Odd behavior with large pyramidal tiff creation with VIPS
Author: dgutman
Created: 2012-01-17 22:03:04+00:00
State: open

I have been using VIPS to create pyramidal TIFF Files for quite some time with good success.. I have recently started using even larger images, and now running into some odd behavior. The files are still viewable, but the created image size are 10X the base image.... whereas I would expect ~ a 2 fold increase over the base image size. (1+1/2 +1/4 +1/8 ... etc).

Originally I was typing the following command:
vips im_vips2tiff --vips-progress --vips-concurrency=2 xaaa.tif xaaa.tif.dzi.tif:deflate,tile:256x256,pyramid

tiffinfo for base image (which is 1.1 gigs or so)
TIFF Directory at offset 0x44e74cc6 (1156009158)
Subfile Type: (0 = 0x0)
Image Width: 74827 Image Length: 44053 Image Depth: 1
Tile Width: 240 Tile Length: 240
Bits/Sample: 8
Compression Scheme: JPEG
Photometric Interpretation: RGB color
Samples/Pixel: 3
Planar Configuration: single image plane
ImageDescription: Aperio Image Library v9.0.22

Gets converted to a 1.6 GB tiff image... makes sense

My newer images are slightly different (come from a different source), but are a single plane image... Since these images are larger (40X slide images instead of 20X images) I've recompiled with BIGTIFF support (version 4.0 beta 7) LIBTIFF, Version 4.0.0

vips-7.26.7-Mon Jan 9 13:54:52 EST 2012

So my input image in this case is about 3.0 gigs (tiffinfo below)... but the output file using LZW is HUGE... approximately 30 gigs.

TIFF Directory at offset 0xbc59487c (3159967868)
Image Width: 131072 Image Length: 98304
Tile Width: 512 Tile Length: 512
Bits/Sample: 8
Compression Scheme: JPEG
Photometric Interpretation: RGB color
FillOrder: msb-to-lsb
YCbCr Subsampling: 2, 2
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
JPEG Tables: (289 bytes)

------------- TRIED VARYING OPTIONS OF VIPS_2tiff ..

22G AGD-17.deflate.dzi.tif
4.3G AGD-17.jpg75.dzi.tif
6.5G AGD-17.jpg90.dzi.tif
28G AGD-17.lzw.dzi.tif <---- the biggest version

22509212 AGD-17.deflate.dzi.tif
4487052 AGD-17.jpg75.dzi.tif
6795540 AGD-17.jpg90.dzi.tif
28615392 AGD-17.lzw.dzi.tif

the command I passed was

vips --vips-concurrency=2 --vips-progress im_vips2tiffI NPUT_IMAGE.tif OUTPUT_IMAGE.dzi.tif:lzw,tile:256x256,pyramid,,,,8

The image conversion goes fine... but somehow it takes a 3 gig file and makes it 32 gigs.... and the file is converting properly...

here's the tiffinfo for the "delfated" / biggest version...

TIFF Directory at offset 0x3f0a323ce (16922125262)
Image Width: 131072 Image Length: 98304
Tile Width: 256 Tile Length: 256
Resolution: 10, 10 pixels/cm
Bits/Sample: 8
Compression Scheme: AdobeDeflate
Photometric Interpretation: RGB color
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
TIFF Directory at offset 0x5005a4c0c (21480754188)
Image Width: 65536 Image Length: 49152
Tile Width: 256 Tile Length: 256
Resolution: 10, 10 pixels/cm
Bits/Sample: 8
Compression Scheme: AdobeDeflate
Photometric Interpretation: RGB color
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
TIFF Directory at offset 0x546f35236 (22665187894)
Image Width: 32768 Image Length: 24576
Tile Width: 256 Tile Length: 256
Resolution: 10, 10 pixels/cm
Bits/Sample: 8
Compression Scheme: AdobeDeflate
Photometric Interpretation: RGB color
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
TIFF Directory at offset 0x5587d581c (22959446044)
Image Width: 16384 Image Length: 12288
Tile Width: 256 Tile Length: 256
Resolution: 10, 10 pixels/cm
Bits/Sample: 8
Compression Scheme: AdobeDeflate
Photometric Interpretation: RGB color
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
TIFF Directory at offset 0x55c8bd05a (23027503194)
Image Width: 8192 Image Length: 6144
Tile Width: 256 Tile Length: 256
Resolution: 10, 10 pixels/cm
Bits/Sample: 8
Compression Scheme: AdobeDeflate
Photometric Interpretation: RGB color
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
TIFF Directory at offset 0x55d7dca74 (23043361396)
Image Width: 4096 Image Length: 3072
Tile Width: 256 Tile Length: 256
Resolution: 10, 10 pixels/cm
Bits/Sample: 8
Compression Scheme: AdobeDeflate
Photometric Interpretation: RGB color
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
TIFF Directory at offset 0x55db9bebe (23047290558)
Image Width: 2048 Image Length: 1536
Tile Width: 256 Tile Length: 256
Resolution: 10, 10 pixels/cm
Bits/Sample: 8
Compression Scheme: AdobeDeflate
Photometric Interpretation: RGB color
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
TIFF Directory at offset 0x55dc8e336 (23048282934)
Image Width: 1024 Image Length: 768
Tile Width: 256 Tile Length: 256
Resolution: 10, 10 pixels/cm
Bits/Sample: 8
Compression Scheme: AdobeDeflate
Photometric Interpretation: RGB color
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
TIFF Directory at offset 0x55dce63ac (23048643500)
Image Width: 512 Image Length: 384
Tile Width: 256 Tile Length: 256
Resolution: 10, 10 pixels/cm
Bits/Sample: 8
Compression Scheme: AdobeDeflate
Photometric Interpretation: RGB color
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
TIFF Directory at offset 0x55dcf6af6 (23048710902)
Image Width: 256 Image Length: 192
Tile Width: 256 Tile Length: 256
Resolution: 10, 10 pixels/cm
Bits/Sample: 8
Compression Scheme: AdobeDeflate
Photometric Interpretation: RGB color
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane