[gdal-dev] Reading a JP2 file - obj_decode() failed

Even Rouault even.rouault at spatialys.com
Sun Aug 9 07:21:58 PDT 2020


On dimanche 9 août 2020 12:47:33 CEST Jonathan Moules wrote:
> Hi Even,
> Thanks for getting back to me. I'm a little rusty with GDAL; it has
> probably been 5+ years since I last used it.
> 
> I can confirm my QGIS install version (OSGEO4W) does have the JP2ECW
> driver (`gdalinfo --formats`).
> 
> I'm using the Python GDAL build from
> https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal - doesn't say it
> includes JP2ECW. I only have access to that GDAL build via Python but
> haven't managed to figure out what the Python API equivalent of
> "gdalinfo --formats" is (assuming there is one).
> 
> I don't seem to be able to force JP2OpenJPEG on the OSGeo4W one.
> gdalinfo --config GDAL_SKIP JP2ECW FILENAME.jp2   = uses the MrSID driver
> gdalinfo --config GDAL_SKIP JP2ECW --config GDAL_SKIP JP2MrSID
> FILENAME.jp2   = Goes back to JP2ECW

If you specify several times a configuration option, the last value for a given key will override 
the previous one(s). You can skip several drivers by using comma as a separator. And I forgot 
a very important switch for what I had in mind, "--debug on" instead of my buggy --format

So try:

gdalinfo --config GDAL_SKIP JP2ECW,JP2MrSID --debug on FILENAME.jp2 

> I can't help but notice the block size and overview levels are reporting
> different info compared to the JP2ECW output 

Yes, the various JPEG2000 driver have different logic (or arbitrariness...) to decide the block 
size. For the JP2OpenJPEG driver, 1024x1024 is either because it is the JPEG2000 tile size or 
as an arbitrary block size for a single tiled image. The --debug on will output lower level info.

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200809/cf2d10e2/attachment.html>


More information about the gdal-dev mailing list