0

I currently have a C# project given to me that requires the converting any image to a 1bit Bitmap Image.

So far so good. The code is working perfectly well.

When the coverted file is sent to another colleague who needs it for a program that I can only guess was coded on the ark it throws this error:

resource file res\icon3.bmp is not in 3.00 format 

How can I get my application to save in a 3.00 format? It's a bit of a head scratcher.

tripbrock
  • 952
  • 4
  • 13
  • 28
  • Hard to tell what's wrong without code (like image saving code) or example image. Better examine your bitmap file byte by byte and compare with the .bmp file format specification: http://en.wikipedia.org/wiki/BMP_file_format – Khôi Oct 02 '12 at 09:59
  • Was a massive schoolboy error on my part! Code was perfect apart from one line which I will add in as an answer. – tripbrock Oct 02 '12 at 13:19

1 Answers1

2

School boy error! Although the conversion code was fine and working perfectly the error was with the image.save! Even though I had a bitmap file - while analysing the header it was a PNG. Very strange. The code was this:

 image.Save(newfilename);

After some headscratching this solved the problem:

 n.Save(newfilename,ImageFormat.Bmp);

I hope this helps someone.

tripbrock
  • 952
  • 4
  • 13
  • 28
  • 2
    The [documentation for Image.Save](http://msdn.microsoft.com/en-us/library/ktx83wah.aspx) explains that if no encoder is present it will save the image as PNG. That is probably the case here. – Henrik Ripa Oct 02 '12 at 13:27