[gdal-dev] GDAL unable to write 4-band RGBA jp2 file with Kakadu 7.8
jason.liu
jason.liu at spookfish.com
Mon Feb 13 20:14:04 PST 2017
Hi gdal-dev,
I am having trouble using GDAL to write 4-band RGBA jp2 file with Kakadu
7.8. The following minimal code
GDALAllRegister();
GDALDataset* srcDataset =
(GDALDataset*)GDALOpen("/home/jason.liu/00000783.tif", GA_ReadOnly);
char **papszOptions = NULL;
papszOptions = CSLSetNameValue( papszOptions, "QUALITY", "20" );
GDALDriver *driver = GetGDALDriverManager()->GetDriverByName("JP2KAK");
GDALDataset* destDataset =
driver->CreateCopy("/home/jason.liu/00000783.jp2",
srcDataset,
FALSE,
papszOptions,
NULL,
NULL);
if( destDataset != NULL ) {
GDALClose( (GDALDatasetH) destDataset );
}
GDALClose( (GDALDatasetH) srcDataset );
CSLDestroy(papszOptions);
crashes Kakadu 7.8 with the following message in stderr:
ERROR 1: Error in Kakadu File Format Support:
Attempting to create a Component Mapping (cmap) box, one of whose channels
refers to a non-existent image component or palette lookup table.
terminate called after throwing an instance of
'kdu_cpl_error_message::JP2KAKException'
where /home/jason.liu/00000783.tif is a 4-band 16-bit RGBA tif.
I have also done the following tests and noted the results:
3-band 8-bit RGB tif OK
3-band 16-bit RGB tif OK
4-band 8-bit RGBA tif error as above
4-band 16-bit RGBA tif error as above
Am I doing anything wrong here?
By the way, I am quite certain Kakadu 7.8 supports 4-band RGBA as I can use
their example kdu_compress to produce 4-band RGBA jp2 images. So this looks
to be a problem with GDAL, or the way I am invoking it.
Any insights will be greatly appreciated.
Kind Regards
Jason
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/GDAL-unable-to-write-4-band-RGBA-jp2-file-with-Kakadu-7-8-tp5307801.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
More information about the gdal-dev
mailing list