Opened 17 years ago

Last modified 17 years ago

#1470 closed defect

gdalwarp with pixel interleave, resample, and compress makes huge files — at Version 5

Reported by: matt.wilkie@… Owned by: warmerdam
Priority: normal Milestone: 1.4.1
Component: GDAL_Raster Version: 1.4.0
Severity: major Keywords:
Cc:

Description (last modified by warmerdam)

Using gdalwarp with -co interleave=pixel produces larger files than gdal_translate does with the same option. Combining pixel interleaving with resampling and compression makes even larger files than when no compression at all is used. When the 3 are used together I get file sizes up to 200% larger than no compression at all.

Original:
	328,390 source.tif

Various combinations of gdalwarp -co [options]:
	# lzw	-co compress=lzw
	# pix	-co pixel=interleave
	# rb	-rb

	165,284 gw_lzw.tif
	263,640 gw_lzw-rb.tif
	304,716 gw_pix-lzw.tif
	340,604 gw_pix-rb.tif
	340,604 gw_pix.tif
	524,786 gw_lzw-pix-rb.tif ***

The above pushed through gdal_translate -co compress=lzw -co interleave=pixel:
	123,292 tr_gw_lzw.tif
	123,292 tr_gw_pix-lzw.tif
	123,292 tr_gw_pix.tif
	123,408 tr_source.tif

...and with gdal_translate -co compress=none
	328,274 tr_nocomp_gw_lzw-rb.tif
	...etc.

...and with gdal_translate -co compress=none -co interleave=pixel:
	328,274 tr_nocomp-pix_gw_lzw-rb.tif
	...etc.

Command lines to produce these files:

gdalwarp -co interleave=pixel source.tif gw_pix.tif
gdalwarp -co compress=lzw source.tif gw_lzw.tif
gdalwarp -co compress=lzw -co interleave=pixel -rb source.tif gw_lzw-pix-rb.tif

Change History (4)

by matt.wilkie@…, 17 years ago

Attachment: source.tif added

source image

by matt.wilkie@…, 17 years ago

Attachment: gw_lzw-pix-rb.tif added

rb, pix interleave, and lzw combined, 1.6 times larger than original

comment:1 by matt.wilkie@…, 17 years ago

Workaround for when this bug causes failures when output is over 4gb:

   gdalwarp -of HFA [list of input] xxx.img
   gdal_translate -co compress=lzw xxx.img xxx_lzw.tif
 
If you need to reassign nodata lost above:

   gdalwarp --co compress=lzw -srcnodata 255 -dstnodata 255 xxx_lzw.tif xxx-lzw-nodata.tif

And now properly compress and interleave final output:

   gdal_translate -co compress=lzw -co interleave=pixel xxx_lzw-nodata.tif final.tif

comment:5 by warmerdam, 17 years ago

Description: modified (diff)
Milestone: 1.4.1
Severity: normalmajor
Status: newassigned
Note: See TracTickets for help on using tickets.