Hi, Can anybody help me with saving TIFF images? I need to save 8 bit image to 16 bit image. Raster data is keeping in Byte array. When i save from 8 bit to 8 bit it works good. But when i save from 8 to 16 bit Gdal creates an image, that i can read after with this library, but not with another program that supports 16 bit images. I wrote a program that makes byte shift. So when shifting at 4 bytes in each image row it displays correctly. In documentation i have read that GDAL automatically translates data types.
Image colorscheme is in RGB. Here is the part of code: GDALDataset *new_dataset; new_dataset=driver->Create(Filename, image_size_x, image_size_y, poDataset->GetRasterCount(), GDT_Int16, NULL); for (int raster=0;raster<poDataset->GetRasterCount();raster++) { GDALRasterBand *new_rasterband; new_rasterband=new_dataset->GetRasterBand(raster+1); for (int j=0;j<image_size_y;j++) { Byte * scanline=new Byte[image_size_x]; new_rasterband->RasterIO(GF_Write, 0,//start position in X y,//start position in Y image_size_x, 1, scanline, image_size_x,//buffer 1, GDT_Byte, 0, 0); } } -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Saving-16-bit-image-tp6606613p6606613.html Sent from the GDAL - Dev mailing list archive at Nabble.com. _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev