i want to convert a tif image to bmp i was following tutorial in https://trac.osgeo.org/gdal/wiki/GdalOgrCsharpRaster but i dont get an image i want to see
the code is :
// Creating a Bitmap to store the GDAL image in
Bitmap bitmap = new Bitmap(xsize, ysize, PixelFormat.Format32bppRgb);
// Creating a C# array to hold the image data
byte[] r = new byte[xsize * ysize];
bands[0].ReadRaster(0, 0, xsize, ysize, r, xsize, ysize, 0, 0);
// Copying the pixels into the C# bitmap
for (int i = 0; i < xsize; i++)
{
for (int j = 0; j < ysize; j++)
{
Color newColor = Color.FromArgb(Convert.ToInt32(r[i + j * xsize]), Convert.ToInt32(r[i + j * xsize]), Convert.ToInt32(r[i + j * xsize]));
bitmap.SetPixel(i, j, newColor);
}
}
bitmap.Save("F:\dijajal.jpeg", ImageFormat.Jpeg);
Original image
Output Image