Opened 18 years ago

Closed 17 years ago

#985 closed defect (wontfix)

i cann't write color table into ERDAS image

Reported by: wjimage@… Owned by: Mateusz Łoskot
Priority: normal Milestone:
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: hfa
Cc: warmerdam

Description (last modified by warmerdam)

the data of the output file is ok.
just the function :
cErr = GDALSetRasterColorInterpretation( pDstBand, GCI_PaletteIndex );
failed.

the source is:

// the following function return "CE_Failure"

	cErr = GDALSetRasterColorInterpretation( pDstBand, GCI_PaletteIndex );
	
	hTable = GDALCreateColorTable(GPI_RGB);
// the following function return CE_None
	cErr = GDALSetColorEntry( hTable, nClassNum, pColor );


the erdas image is created in my program.and the image data is ok.
the color table part when using gdalinfo is:

here: nClassNum = 6;

colorinterp = palette
color table <RGB with 7 entries>

but the color entries is incorrect:

1-6 entries are all zero
7 is: 0,0,255,1 is the first element of pColor.

i have traced the function

void GDALColorTable::SetColorEntry( int i, const GDALColorEntry * poEntry )

{
    if( i < 0 )
        return;
    
    if( i >= static_cast<int>(aoEntries.size()) )
    {
        GDALColorEntry oBlack;
        oBlack.c1 = oBlack.c2 = oBlack.c3 = oBlack.c4 = 0;
        aoEntries.resize(i+1, oBlack);
    }

    aoEntries[i] = *poEntry;
}


it seems that the program enter the if statement.

Change History (2)

comment:1 by warmerdam, 17 years ago

Cc: warmerdam added
Description: modified (diff)
Keywords: hfa added
Milestone: 1.4.2
Owner: changed from warmerdam to Mateusz Łoskot
Priority: highnormal

Mateusz,

Time permitting, I'd appreciate your looking into this. The HFA driver should support writing colormaps though there might be limitations. This issue might also have been resolved since the bug was filed.

comment:2 by warmerdam, 17 years ago

Milestone: 1.4.2
Resolution: wontfix
Status: newclosed

On a bit deeper review, I don't see an issue here. It is intentional that the GDALColorTable "fills holes". It isn't clear that there is any other issue.

I'm closing. 'wjimage' can reopen if there is a clearer problem that can be demonstrated.

Note: See TracTickets for help on using tickets.