Opened 16 years ago

Closed 16 years ago

#1908 closed defect (fixed)

Support grayscale overviews on 1bit images

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone: 1.5.0
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: hfa gtiff overview
Cc: gaopeng

Description

Many existing .aux/.rrd overviews for 1bit TIFF images have been generated as 8bit greyscale overviews varying between 0 and 255 instead of the 0/1 of the base image. These were created with Leica and/or ESRI products. It is desirable to have a way for GDAL to recognise these images, and not use these overviews in RasterIO() at reduced resolutions. It is also desirable to be able to generate these sorts of overviews for use in ArcGIS or applications that do not require overviews to have exactly the same characteristics as base layers.

Change History (4)

comment:1 by warmerdam, 16 years ago

Status: newassigned

I have largely resolved this in trunk in r12436 and r12437.

The general approach is to support a special metadata item on overviews named RESAMPLING. If the value of that is BIT2GRAYSCALE then the overview is believed to be an 8bit grayscale rendition of a full resolution 1 bit layer.

The RasterIO() calls will now ignore such overviews when selecting overviews to accelerate rasterio requests since they mess up the assumption that overviews have the same structure as base layers. But applications can still use the overviews directly if they want, and are careful in handling.

The gdaladdo and BuildOverviews() methods now support the "AVERAGE_BIT2GRAYSCALE" as a resampling option indicating that 1bit layers should have grayscale overviews built (and marked with special metadata).

The gdalinfo program now lists "special" overviews that can't be used by RasterIO() with an asterix.

The GTiff driver supports keeping the RESAMPLING metadata for overviews.

The HFA driver will return RESAMPLING=AVERAGE_BIT2GRAYSCALE if the base layer is 1bit, and the overview is 8bit.

I think the problem is resolved, but I would like to add some minimal regression testing of this new feature set, and possibly some documentation before closing this report.

comment:2 by hobu, 16 years ago

Frank,

These changes broke the build when using --with-geotiff=internal

Howard

comment:3 by warmerdam, 16 years ago

Sorry about that, I missed committing one file. Fixed now.

comment:4 by warmerdam, 16 years ago

Resolution: fixed
Status: assignedclosed

Added testing of bit2grayscale in autotest/gcore/tiff_ovr.py (tiff_ovr_4 test).

Note: See TracTickets for help on using tickets.