Opened 18 years ago

Last modified 18 years ago

#984 closed defect (fixed)

i cann't write color table into ERDAS image

Reported by: wjimage@… Owned by: warmerdam
Priority: high Milestone:
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords:
Cc:

Description

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 (1)

comment:1 by warmerdam, 18 years ago

Is there a reason this bug is now marked fixed? 

Note: See TracTickets for help on using tickets.