4

I'm trying to convert Sentinel-2 imagery in jp2000 (.jp2) format to geotiff format using gdal_translate. However, it appears .jp2 format is not recognized. What method should I use to convert jp2000 format to geotiff?

$ gdal_translate B02.jp2 B02.tif
ERROR 4: `B02.jp2' not recognised as a supported file format.

GDALOpen failed - 4
`B02.jp2' not recognised as a supported file format.
Borealis
  • 8,044
  • 17
  • 64
  • 112

2 Answers2

4

If you are on macOS and want JP2000 with GDAL, one option is to use homebrew to install it like this:

brew install gdal --with-complete

Then you get this:

gdalinfo --formats | grep -i jp

  JPEG (rwv): JPEG JFIF
  JPEG2000 (rwv): JPEG-2000 part 1 (ISO/IEC 15444-1)
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
2

This is because the jasper jp2 driver in gdal cannot handle big jp2 files. Also, there is no easy way of changing the jp2 driver of gdal.

So, simply install Kakadu from: http://kakadusoftware.com/downloads/

Then convert your large jp2000 file to geotiff using Kakadu: kdu_expand -i input.JP2 -o output.tif -num_threads 4

Then you can use your gdal functions with the converted geotiff.

Yu Tao
  • 758
  • 5
  • 9
  • This utility turned the JP2000 into a monochrome TIFF much larger than that produced by gdal_translate which I happen to have some driver that successfully converts. I was looking for survival of the georeferencing. – Bob Denny Oct 08 '20 at 19:09