first thanks for the great job you did with freeimage!
But it seems to have an error. I use 16 grayscale pictures, and the function getbitmap() give me a pretty green pictures.
Before discovering your work I had build my own wrapper and use the following way to getbitmap :
// Temporary FIBITMAP for conversion
int conv = FreeImageApi.ConvertToStandardType(m_Handle, true);
PixelFormat pixFormat = PixelFormat.Format32bppArgb;
// Gets some information
int height = (int)FreeImageApi.GetHeight(conv);
int width = (int)FreeImageApi.GetWidth(conv);
Hello,
first thanks for the great job you did with freeimage!
But it seems to have an error. I use 16 grayscale pictures, and the function getbitmap() give me a pretty green pictures.
Before discovering your work I had build my own wrapper and use the following way to getbitmap :
// Temporary FIBITMAP for conversion
int conv = FreeImageApi.ConvertToStandardType(m_Handle, true);
PixelFormat pixFormat = PixelFormat.Format32bppArgb;
// Gets some information
int height = (int)FreeImageApi.GetHeight(conv);
int width = (int)FreeImageApi.GetWidth(conv);
// Prepares bitmap object
Bitmap bmp = new Bitmap(width, height);
BitmapData bData = bmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, pixFormat);
// Gets the converted values
unsafe
{
byte* bScan0 = (byte*)(void*)bData.Scan0;
for (int y = height - 1; y > 0; y--)
{
byte* bScanline = (byte*)(void*)FreeImageApi.GetScanLine(conv, y);
for (int x = 0; x < width; x++)
{
bScan0[0] = bScanline[x];
bScan0[1] = bScanline[x];
bScan0[2] = bScanline[x];
bScan0[3] = (byte)255;
bScan0 += 4;
}
bScanline++;
}
}
bmp.UnlockBits(bData);
// Frees temporary FIBITMAP memory
FreeImageApi.Unload(conv);
return bmp;
Maybe useful, but only works for grayscaled pictures