[Gdal-dev] Error reading jp2: 'terminate called after throwing an instance of 'std::bad_alloc'

Frank Warmerdam warmerdam at pobox.com
Fri Jan 19 16:28:10 EST 2007

Patton, Eric wrote:
> Frank,
> Running the command you suggested seems to only use the JPEG2000 driver. I
> get lines and lines of the following:
> <snip> ... JPEG2000: Component 41921: bpp=4, signedness=0 JPEG2000:
> Component 41922: bpp=4, signedness=0 JPEG2000: Component 41923: bpp=4,
> signedness=0 JPEG2000: Component 41924: bpp=4, signedness=0 JPEG2000:
> Component 41925: bpp=4, signedness=0 terminate called after throwing an
> instance of 'std::bad_alloc' what():  St9bad_alloc Aborted
> Only the last few lines of output are shown. Does it matter what order I
> compiled jasper-1.900.0.uuid vs. libecwj2-3.3? I believe I complied jasper
> first, if it matters.


I think the --config option takes effect after registration which is likely
why it is having no effect.  Setting GDAL_SKIP ahead of time as an
environment variable, or building without JasPer should ensure GDAL
uses the JP2ECW driver instead of the JPEG2000 driver.

> Thanks for the suggestion for FWTools. I installed it under Windows, and
> imported a 9.5MB jp2 file as a test - OpenEV exported this jp2 to an 800MB
> tiff! I wonder how big the 291MB jp2 file  would expand to.

1:10 expansion is common, 1:100 less so.  Note that TIFF only supports up to
4GB files, so if it is going to be very large you will need to use
a different format, like HFA (erdas imagine).

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

More information about the Gdal-dev mailing list