Writing to a bimap and saving it, makes it unusable
Posted on 2006-05-09
I start with a bitmap which is readable by MapPoint. The variable name of the bitmap (defined earlier) is called "fileName". Then I write the digit "1" on it, and save the file. The subsequent bitmap can not be added to a MapPoint symbol's list. It produces the following exception:
"The format of this bitmap is not supported. Bitmaps must be uncompressed and use 1, 4, 8 or 24 bit color".
Can anyone see in my code what I am doing wrong?
Image img = Image.FromFile(fileName);
Bitmap bmp = new Bitmap(img);
// get a graphics so we can draw
Graphics g = Graphics.FromImage(bmp2);
Font arial = new Font( "Arial", 7 );
Font arialBold = new Font( arial, FontStyle.Bold );
g.DrawString("1", arialBold, Brushes.White, new PointF(3,1));
// release the graphics
// save the changes in the original fileName
bmp.Save( "newVersion.bmp", System.Drawing.Imaging.ImageFormat.Bmp);