[gdal-dev] Gdal + Kakadu + Python : unable to write JPEG2000 correctly

CGA cgallay.artal at gmail.com
Wed Feb 15 06:04:06 PST 2017

Dear all,

I'm struggling with the Python bindings of GDAL + Kakadu. I'm trying to clip
a small part of an input image in .jp2 and write it inside another .jp2

I read that the JP2KAK images can only be created using the CreateCopy()
method. Here is my workflow :
  - Open input dataset
  - Clip image using ReadAsArray (load into a numpy array)
  - Create a new dataset (using MEM or GTiff driver)
  - Write clipped array in new dataset
  - Convert created dataset to JP2 using JP2KAK driver CreateCopy() method

As a result, I get a JP2 image that contains only one value : 32768 ....
When using the intermediate GTiff driver, I confirmed that the intermediate
dataset is valid.

Here is the code used :

I also tried the following simple script that seems to be working fine (the
script only CreateCopy of an existing JP2 dataset) :

Is there anything wrong in the way I'm creating the JP2 clipped dataset in
the first script ?


View this message in context: http://osgeo-org.1560.x6.nabble.com/Gdal-Kakadu-Python-unable-to-write-JPEG2000-correctly-tp5308040.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.

More information about the gdal-dev mailing list