I have a bunch of jp2 files with size going from 40MB to 1GB and I need to convert them all to GeoTiffs (.tif format). When using gdal_translate for the small files (having the jasper driver to support jp2 files), this works. But when applying this on files with size about 400MB, I get segmentation errors.

gdal_translate input.jp2 output.tif

In another attempt I've used opj_decompress (from the JP2OpenJPEG library) to convert jp2 to tif files, but again resulted in an error.

opj_decompress -i input.jp2 -o output.tif

Is there a way to handle large jp2 files with GDAL (or another library) to convert them to .tif?

1 Answer 1


Jasper driver is useless for big JPEG2000 files. OpenJPEG driver is OK if source JPEG2000 is tiled, otherwise you will need JP2ECW, JP2KAK, or JP2MrSID driver. Check your drivers with gdalinfo --formats and use --config GDAL_SKIP for skipping the first JP2 drivers from the list for selecting the driver you want to use.

Example output from GDAL compiled with two JP2 drivers:

gdalinfo --formats
JP2ECW (rov): ERDAS JPEG2000 (SDK 5.0)
JP2OpenJPEG (rwv): JPEG-2000 driver based on OpenJPEG library

If you wand to use JP2OpenJPEG driver which is the second on the list you must skip the first driver:

gdal_translate -of GTiff input.jp2 output.tif --config GDAL_SKIP JP2ECW
  • I'm having problems with installing those particular drivers. Are those free to use and how can I get them in that 'gdalinfo --formats' list? Right now the only one supporting jp2 file is the jasper driver.
    – ABC
    Commented Nov 7, 2015 at 13:37
  • 2
    Only OpenJPEG is free. Others may be free to use to some extent but you must accept the license terms and acquire SDK separately. Windows builds at gisinternals.com include OpenJPEG and ECWJP2 drivers. I am not good at compiling programs and if you need your own build on Linux let's hope someone else knows how to help you.
    – user30184
    Commented Nov 7, 2015 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.