Ticket #985 (closed defect: wontfix)

Opened 8 years ago

Last modified 6 years ago

i cann't write color table into ERDAS image

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

Description (last modified by warmerdam) (diff)

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

Changed 6 years ago by warmerdam

  • description modified (diff)
  • cc warmerdam added
  • priority changed from high to normal
  • owner changed from warmerdam to mloskot
  • milestone set to 1.4.2
  • keywords hfa added

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.

Changed 6 years ago by warmerdam

  • status changed from new to closed
  • resolution set to wontfix
  • milestone 1.4.2 deleted

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.