Not been able to save raster into file or display through a MemoryStream and BitmapImage. #117
-
Running the example at GDAL repository throws "A generic error occurred in GDI+." when trying to save the Bitmap to the file. I've tried to save to a memory stream and displaying the image in a WPF application with the following code, but it shows the same behaivour throwing the exception when saving to the using var stream = new MemoryStream();
bitmap.Save(stream, ImageFormat.Bmp);
stream.Position = 0;
DisplayImage = new BitmapImage();
DisplayImage.BeginInit();
DisplayImage.StreamSource = stream;
DisplayImage.CacheOption = BitmapCacheOption.OnLoad;
DisplayImage.EndInit(); Has anyone had this same issue? How can I debug further given that GDI+ is not great with errors? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I have no clue as it's not related to GDAL, but this could help. Especially, this answer (non-existent folder in path or missing permissions) |
Beta Was this translation helpful? Give feedback.
-
I'm aware it's not a problem directly related with GDAL. Still wondering if someone could know why this might be happening and could help. I'm saving directly to a |
Beta Was this translation helpful? Give feedback.
I have no clue as it's not related to GDAL, but this could help.
https://stackoverflow.com/questions/15862810/a-generic-error-occurred-in-gdi-in-bitmap-save-method
Especially, this answer (non-existent folder in path or missing permissions)
https://stackoverflow.com/a/23695771