[gdal-dev] JP2 files created with JP2OpenJPEG can only have 1 or 3 bands?

Even Rouault even.rouault at spatialys.com
Wed Oct 15 12:48:06 PDT 2014


Le mercredi 15 octobre 2014 21:19:37, Paul Hasenohr a écrit :
> Hello,
> 
> I just compiled gdal-1.11.1 with support for jpeg2000 through OpenJPEG
> and wanted to convert a 4 bands TIFF file (with LZW compression) into a
> lossless JP2 file.
> While attempting to run gdal_translate, I received this error message
> ERROR 6: Unable to export files with 4 bands
> 
> Looking at the file openjpegdataset.cpp [1], it seems that CreateCopy()
> only supports 1 band and 3 bands files. The option for 4 bands is even
> commented out. What is the reason for this?
> Would it be possible to support the creation of JPEG2000 of any number
> of bands?
> Can I safely enable the creation of 4 bands files?

I tested that recently and it mostly works except that the alpha band is not 
correctly declared as alpha band, so other JPEG2000 codecs will see it as a 
"unknown" band. I couldn't find in the openjpeg API how to declare an alpha 
band. This would likely involved writing the appropriate information in a JP2 
box.

> 
> I want to create GMLJP2 files as it is one option suggested by the
> INSPIRE technical guidelines on orthoimagery and I would like to use
> GDAL for this.
> 
> Thank you for your support.
> 
> Best regards,
> Paul Hasenohr
> 
> [1]
> https://svn.osgeo.org/gdal/trunk/gdal/frmts/openjpeg/openjpegdataset.cpp
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list