Skip to main content
7 events
when toggle format what by license comment
Sep 30, 2022 at 4:48 comment added Michael Stimson I tested your code exactly as written (different raster paths though) with the flush to close and it worked for me. The 16/8 bit data type was not a problem. I'm using 64 bit GDAL 1.11.1, released 2014/09/24 with Visual Studio 2012, version 11.0.61219.00 update 5 which is a bit newer than your version of studio, perhaps you might need to grab a much older dev version of GDAL from the archives of GISInternals gisinternals.com/archive.php.
Sep 30, 2022 at 2:25 comment added Michael Stimson The only thing I can see different is I allocate my memory using _aligned_malloc learn.microsoft.com/en-us/cpp/c-runtime-library/reference/… to ensure multibyte types align with the word boundary. As your input raster is of type GDT_Byte perhaps it would be a good time to change the data types to match the input. In the meantime I'll test your code on an 8 bit 3 band raster I have locally.
Sep 29, 2022 at 8:39 comment added Blue Thank you so much. Unfortunately, the way didn't work. All the value of the new image is still 128. Do you have other idea of that situation?
Sep 29, 2022 at 5:24 history edited Michael Stimson CC BY-SA 4.0
Add flush and Destroy
Sep 29, 2022 at 5:20 comment added Michael Stimson Perhaps there's still a reference remaining, try flush the writes and GDALDestroyDriverManager(); on the very last line, I'll edit that into the code to show where I put them.
Sep 29, 2022 at 4:44 comment added Blue Thank for your answer. It's quite clear. I read the document and I just notice that I shouldn't use 'delete pOldDS;'. I changed my close statements to: GDALClose((GDALDatasetH)pOldDS); GDALClose((GDALDatasetH)pNewDS); However, all the value of the new image is still 128.
Sep 28, 2022 at 7:35 history answered Michael Stimson CC BY-SA 4.0