Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I wanted to reduce the number of bands of a tif file from 3 to 1...

I used this command

rgb2pct.py -n 256 fnp_braunschweig.tif fnp_bs.tif

and it increased the size from 31mb to 778mb

I actually want to decrease the size of the file.

can anyone tell me why this is happening?

cheers,

Rob

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

The output Tiff is likely not using compression, hence the larger file size. Use the gdal_translate command, something along the lines of this:

gdal_translate -of GTiff -co "COMPRESS=DEFLATE" -b N fnp_braunschweig.tif fnp_bs.tif

where N is the band number you want to keep. The options for compression are NONE, LZW, PACKBITS, JPEG, CCITTRLE, CCITTFAX3, CCITTFAX4, DEFLATE.

share|improve this answer
1  
Especially note the -co "COMPRESS=DEFLATE" and -co "PHOTOMETRIC=YCBCR" if appropriate. Use gdalinfo to determine what the compression settings of the original tiff were and use creation options from gdal.org/frmt_gtiff.html appropriately. –  Howard Butler Feb 23 '12 at 14:05
    
thanks. how can I compress three bands into one? I don´t want to pick either red,green, or blue, I just want to compress them into one. –  Robert Buckley Feb 23 '12 at 21:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.