[gdal-dev] gdalwarp and GTiff creation option NBITS
Fischer, Andreas
Andreas.Fischer at kreis-unna.de
Fri Jun 11 09:46:11 EDT 2010
Dear list,
I try to convert a raster images (GTiff) with gdalwarp. The images only have two colors (black/white) and the color table just have two entries. Therefore the file size for each image is exactly as big as needed (1bit/pixel). The result of gdalwarps transformation are images with 8bits / pixel and 256 entries in the color table. The file size for each image is increased but in this case this is without benefit, because the results are still black and white.
So I tried the creation option "-co NBITS=1". Color Table und file size are now exactly as I expected, but I can't display the result properly with any program. For example IrfanView does fine, but unfortunately MapInfo Professional doesn't. MapInfo Professional just shows irregular stripes. After opening the result file in IrfanView and saving it as a copy, the copy is displayed in MapInfo fine as well. I do not understand this behavior, because gdalinfo doesn't show any differences.
For I do have a lot of automatic batch processing I can't use IrfanView for this purpose and I'm interested in doing this only using comandline utilities of gdal. So I would be glad to get help from you or any hints.
Thank you so far and best regards
Andreas Fischer
P.S.:
For better explanation the gdalwarp comandline and gdalinfo outputs:
gdalwarp -s_srs C:\Programme\FWTools2.4.6\proj_lib\25832.wkt -t_srs "+proj=tmerc +lat_0=0 +lon_0=6 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel units=m +nadgrids=C:\Programme\FWTools2.4.6\proj_lib\BETA2007.gsb +wktext" -dstnodata 0 -srcnodata 0 -co TFW=YES -co INTERLEAVE=PIXEL -co TILED=YES -co
NBITS=1 32395_5718.tif utm2gk\1bit\32395_5718.tif
(using FWTools 2.4.6)
gdalinfo (original file)
Driver: GTiff/GeoTIFF
Files: 32395_5718.tif
32395_5718.tfw
Size is 11812, 11812
Coordinate System is `'
Origin = (394999.957670164990000,5719000.042329834800000)
Pixel Size = (0.084659670000000,-0.084659670000000)
Metadata:
TIFFTAG_SOFTWARE=Handmade Software, Inc. Image Alchemy v1.13
Image Structure Metadata:
COMPRESSION=CCITTFAX4
INTERLEAVE=BAND
MINISWHITE=YES
Corner Coordinates:
Upper Left ( 394999.958, 5719000.042)
Lower Left ( 394999.958, 5718000.042)
Upper Right ( 395999.958, 5719000.042)
Lower Right ( 395999.958, 5718000.042)
Center ( 395499.958, 5718500.042)
Band 1 Block=11812x5 Type=Byte, ColorInterp=Palette
Image Structure Metadata:
NBITS=1
Color Table (RGB with 2 entries)
0: 255,255,255,255
1: 0,0,0,255
gdalinfo (transformed file, without properly display with MapInfo Professional)
Driver: GTiff/GeoTIFF
Files: 32395_5718.tif
32395_5718.tfw
Size is 12287, 12287
Coordinate System is:
PROJCS["unnamed",
GEOGCS["Bessel 1841",
DATUM["unknown",
SPHEROID["bessel",6377397.155,299.1528128]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",6],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",2500000],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]]]
Origin = (2602804.707705282600000,5720843.723755999500000)
Pixel Size = (0.084692791645049,-0.084692791645049)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 2602804.708, 5720843.724) ( 7d29'3.82"E, 51d36'50.14"N)
Lower Left ( 2602804.708, 5719803.103) ( 7d29'2.72"E, 51d36'16.48"N)
Upper Right ( 2603845.328, 5720843.724) ( 7d29'57.89"E, 51d36'49.45"N)
Lower Right ( 2603845.328, 5719803.103) ( 7d29'56.78"E, 51d36'15.79"N)
Center ( 2603325.018, 5720323.414) ( 7d29'30.30"E, 51d36'32.97"N)
Band 1 Block=12287x5 Type=Byte, ColorInterp=Palette
NoData Value=0
Image Structure Metadata:
NBITS=1
Color Table (RGB with 2 entries)
0: 255,255,255,255
1: 0,0,0,255
gdalinfo (transformed file, saved as copy with IrfanView, displayed properly within MapInfo Professional)
Driver: GTiff/GeoTIFF
Files: 32395_5718_irfan.tif
32395_5718_irfan.tfw
Size is 12287, 12287
Coordinate System is `'
Origin = (2602804.707705282600000,5720843.723755999500000)
Pixel Size = (0.084692791600000,-0.084692791600000)
Metadata:
TIFFTAG_SOFTWARE=IrfanView
TIFFTAG_XRESOLUTION=0
TIFFTAG_YRESOLUTION=0
TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
Image Structure Metadata:
INTERLEAVE=BAND
MINISWHITE=YES
Corner Coordinates:
Upper Left ( 2602804.708, 5720843.724)
Lower Left ( 2602804.708, 5719803.103)
Upper Right ( 2603845.328, 5720843.724)
Lower Right ( 2603845.328, 5719803.103)
Center ( 2603325.018, 5720323.414)
Band 1 Block=12287x5 Type=Byte, ColorInterp=Palette
Image Structure Metadata:
NBITS=1
Color Table (RGB with 2 entries)
0: 255,255,255,255
1: 0,0,0,255
Mit freundlichen Grüßen
Im Auftrag
Andreas Fischer
Kreis Unna - Der Landrat
Zentrale Datenverarbeitung
Friedrich-Ebert-Straße 17
59425 Unna
Fon 02303 27-4416
Fax 02303 27-2896
andreas.fischer at kreis-unna.de
www.kreis-unna.de
Diese E-Mail wurde beim Ausgang auf Viren geprueft. Wegen der
potentiellen Gefahr auf den Uebertragungswegen wird zu einer
Vireneingangskontrolle geraten. Eine Haftung für Virenfreiheit
wird ausgeschlossen.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100611/2983d75a/attachment-0001.html
More information about the gdal-dev
mailing list