ba272
asked on
The format of the bitmap is not supported
Hi,
I have a 256 color bitmap image that's 14 X 14 pixels in size. I used the following code to write a number between 1 and 99, and save it, to create 99 versions of the bitmap. The images get created and look fine. But when I call the following line, I get an exception. It works fine for the stock image file (blank dot) which I use as a base. But when any image I created is used, it throws an exception.
symbol = mpControl.ActiveMap.Symbol s.Add( fileName );
Exception: "The format of the bitmap is not supported. Bitmaps must be compressed and use 1, 4, 8 or 24 bit color."
What can I do differently to so that the 99 images I create will appear no different from the stock image?
Thanks,
Bob
for ( int number=1; number<=99; number++ )
{
string breadCrumbFileName = Preferences.ImagesDir + colorName + number.ToString() + ".bmp";
if ( handles.Utils.FileExists( fileName ) )
{
Image outputImg = Image.FromFile(fileName);
Bitmap outputBmp = new Bitmap(outputImg);
Graphics g = Graphics.FromImage(outputB mp);
// do something with "g"
Font arial = new Font( "Arial", 7 );
Font arialBold = new Font( arial, FontStyle.Bold );
if ( number < 10 )
{
g.DrawString(number.ToStri ng(), arialBold, Brushes.White, new PointF(3,1));
}
else
{
g.DrawString(number.ToStri ng(), arialBold, Brushes.White, new PointF(0,1));
}
// release the graphics
g.Dispose();
// save the changes in the original fileName
outputBmp.Save( breadCrumbFileName, System.Drawing.Imaging.Ima geFormat.B mp);
}
I have a 256 color bitmap image that's 14 X 14 pixels in size. I used the following code to write a number between 1 and 99, and save it, to create 99 versions of the bitmap. The images get created and look fine. But when I call the following line, I get an exception. It works fine for the stock image file (blank dot) which I use as a base. But when any image I created is used, it throws an exception.
symbol = mpControl.ActiveMap.Symbol
Exception: "The format of the bitmap is not supported. Bitmaps must be compressed and use 1, 4, 8 or 24 bit color."
What can I do differently to so that the 99 images I create will appear no different from the stock image?
Thanks,
Bob
for ( int number=1; number<=99; number++ )
{
string breadCrumbFileName = Preferences.ImagesDir + colorName + number.ToString() + ".bmp";
if ( handles.Utils.FileExists( fileName ) )
{
Image outputImg = Image.FromFile(fileName);
Bitmap outputBmp = new Bitmap(outputImg);
Graphics g = Graphics.FromImage(outputB
// do something with "g"
Font arial = new Font( "Arial", 7 );
Font arialBold = new Font( arial, FontStyle.Bold );
if ( number < 10 )
{
g.DrawString(number.ToStri
}
else
{
g.DrawString(number.ToStri
}
// release the graphics
g.Dispose();
// save the changes in the original fileName
outputBmp.Save( breadCrumbFileName, System.Drawing.Imaging.Ima
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Alex,
I am having trouble compiling. PixelFormat could not be found. I am using VS 2003. What namespace is that? WMEncoderLib does not work.
Bob
I am having trouble compiling. PixelFormat could not be found. I am using VS 2003. What namespace is that? WMEncoderLib does not work.
Bob
System.Drawing.Imaging Namespace
ASKER
Thanks. It works. But that presented a new problem.
I write the digits as white, but apparently it's transparent, because many are hard to read because of there they end up on a map.
Any idea how to make this non-transparent?
Thanks,
Bob
I write the digits as white, but apparently it's transparent, because many are hard to read because of there they end up on a map.
Any idea how to make this non-transparent?
Thanks,
Bob
ASKER
I'd like the text I am writing in the circle and the circle to be non-transparent. But I'd like the four corners to be transparent.
I don't know what are requirements of the control you are working with, maybe there is transparent color property, which is set to white.
ASKER
that's okay. You got me over the big hump.
Bob
Bob
ASKER