Saving a large color image as `GTiff` with` gdal`

I am trying to save a large size image (15000, 80000, 3). This array is a numpy array that I initialized as im_final = np.zeros((15000,80000,,3)). To make a save, I use gdalas follows:

dst_ds = gdal.GetDriverByName('GTiff').Create('val.tif', 80000, 15000, 3, gdal.GDT_Byte)
dst_ds.GetRasterBand(1).WriteArray(im_final[:,:,0])   # write r-band to the    raster
dst_ds.GetRasterBand(2).WriteArray(im_final[:,:,1])   # write g-band to the raster
dst_ds.GetRasterBand(3).WriteArray(im_final[:,:,2])   # write b-band to the raster
dst_ds.FlushCache()                     # write to disk
dst_ds = None

When I save it, the resulting image will be black and white. However, I need the image to be RGB, does anyone know what the problem is? In addition, the values ​​in im_finalare equal uint16.

+2
source share
1 answer

, uint16 uint8 (gdal.GDT_Byte). 8- (, , ), im_final 0-255. 0-65535 0-255 min/max 0-255 .

im_final , gdal.GDT_UInt16 driver.Create().

+2

Source: https://habr.com/ru/post/1614552/


All Articles