Hello,
is it somehow possible to export RGB image in GeoTIFF format in python ?
This code works for formats like PNG, JPG, BMP, TIFF but I am unable to export it as GeoTIFF.
def write_rgb_image(bands, filename, format):
image_info = ProductUtils.createImageInfo(bands, True, ProgressMonitor.NULL)
im = ImageManager.getInstance().createColoredBandImage(bands, image_info, 0)
JAI.create("filestore", im, filename, format)
red = product.getBand('gamma3')
green = product.getBand('gamma2')
blue = product.getBand('gamma')
write_rgb_image([red, green, blue], gamma_export, 'TIFF')
When I change TIFF for GeoTIFF I get the error :
INFO: org.hsqldb.persist.Logger: dataFileCache open start
Traceback (most recent call last):
File "RGB_composit.py", line 91, in <module>
rgb_OLCI()
File "RGB_composit.py", line 87, in rgb_OLCI
write_rgb_image([red, green, blue], gamma_export, 'GeoTIFF')
File "RGB_composit.py", line 31, in write_rgb_image
JAI.create("filestore", im, filename, format)
RuntimeError: java.lang.IllegalArgumentException: FileStore The specified format has no associated registered ImageCodec.
I’ve been looking all over the forum but I was unable to fix this. This error seems strange, since in SNAP GUI one can easily export RGB image as GeoTIFF.