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

Paul Hasenohr gdal-ml at hasenohr.eu
Wed Oct 15 13:03:32 PDT 2014


Hello Even,

Thank you for your answer.

In fact in my case, this 4th band is for a Near Infra Red channel so I 
definitely do not want to have it labelled as alpha!
But I will have other satellite images with more than 4 bands (plus 
possibly an alpha band). Would it be possible to simply remove this 
check on the number of bands in CreateCopy()?

Thanks,
Paul

On 15/10/14 21:48, Even Rouault wrote:
> 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
>


More information about the gdal-dev mailing list