[gdal-dev] 1 bits per pixel tif image io driver
Frank Warmerdam
warmerdam at pobox.com
Wed Jan 30 12:19:49 EST 2008
mario beaulieu wrote:
> Hi, i am a newbie.
>
> Is it possible to load 1 bit per pixel image (1BPP) with gdal since
> GDALDataType
> <http://www.gdal.org/gdal_8h.html#22e22ce0a55036a96f652765793fb7a4> does
> not enumerated this type of image?
Mario,
GDAL will automatically treat 1bit TIFF files as 8bit which happen to only
have pixel values 0 and 1. In most cases it will also treat 0 and 1 as having
pseudocolor table entries to provide proper color and it will report metadata
indicating that NBITS=1.
eg.
warmerda at gdal64[53]% gdalinfo misc/fax2d.tif --debug off
Driver: GTiff/GeoTIFF
Files: misc/fax2d.tif
Size is 1728, 1082
Coordinate System is `'
Metadata:
TIFFTAG_SOFTWARE=fax2tiff
TIFFTAG_XRESOLUTION=204
TIFFTAG_YRESOLUTION=98
TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
Image Structure Metadata:
COMPRESSION=CCITTFAX3
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 1082.0)
Upper Right ( 1728.0, 0.0)
Lower Right ( 1728.0, 1082.0)
Center ( 864.0, 541.0)
Band 1 Block=1728x1082 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
So, yes, you can work with 1BPP images.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGeo, http://osgeo.org
More information about the gdal-dev
mailing list