Lookng at the code in FONgTransform, it may be that it should be modified to follow the pattern used for the GeoTIFF code (instead of writing the info to a MEM object and then using CreateCopy to make the JP2k file, use the recipe that is used for GeoTIFF).
There are two copies of the return_temp_stream() method - one for the GeoTIFF code and one for the JP2k code. This should probably be turned into a utility function in the BES.
The tests for the JP2k output are pretty weak
Worth noting, on the GDAL mailing list 15 June 2107
[gdal-dev] [FIXED] Re: OpenJPEG lossless encode broken
On vendredi 17 février 2017 14:02:37 CEST Aaron Boxer wrote:
> See https://github.com/uclouvain/openjpeg/issues/892 for
> Since problems occur unpredictably for various image
dimensions and number
> of encoder decompositions, safest approach is to avoid using
the codec for
> lossless until this issue is resolved.
FYI, this issue has been fixed in OpenJPEG master, as well as with
speed improvements. A new release will come in the following
For more details, see