Main Site Documentation

Is there a way to convert a bmp image to a jpg image?


hi, my project is using gadgeteer camera module to capture picture, and upload the picture to the internet, but the internet server just support recieve jpg, png and gif image, the camera module is only output bmp image, so my problem is how to convert the bmp image to jpg format?
thanks very much!


There is decoding but no encoding. You can add encoding using RLP. The jpeg code is standard and open if you google it.

This requires a bit more advance knowledge in C programming.


Jpeg is a very fiddly, but interesting format.

Once I have a working camera, will probably knock up some code for handling them.

C# is not the greatest language for creating them. Have a look at:

Can we write code in any other languages to send over to the board?


thanks for your replies, it looks like i have to using underlayer method to solve this problem, may be i need consult some jpg encoding arithmetic in c.


Do you have a server where you can run an image converter? BMP->PNG conversion is very easy to write using the .NET Framework. It would be just a few lines of code. For extra points, you could write it as a Web service that automatically sends the result to your destination of choice.

If you want to write a converter yourself, PNG is a much, much simpler format than JPG.


For standard C# .Net
Image myImage = Image.FromFile(“myBMPImage.bmp”);
myImage.Save(“myJPEGImage.jpg”, ImageFormat.Jpeg);

Or take it from a stream, and throw it straight back out if you just want it passed through memory.

New to NetMF, but have seen these.

BMP and JPG image support, and text manipulation.
and reference to it in:

There may just be a decoder that can be included. When i have a working camera, will have a play and see if anything is hidden in there we can use.


Spotted this,

Looks like the system will convert Jpeg to Bitmap

Bitmap picImage = new Bitmap(pictureData, Bitmap.BitmapImageType.Jpeg);


Yes it will decode BMP, JPEG and GIF. But not encode.


hi, Kerry, thanks for your advise, i will try to convert the image to png format, do you have some example code programing in c to reference? besides, may be the easiest way is to change the camera, using a new which output jpg image.


Here’s a tutorial and example code on converting BMP to PNG in C#: I don’t have a C example handy, but can poke around if you like.


thanks a lot!


it seems like you need an image converter to convert the image into formats you desire. it is simplier and fast.


Maybe you can use

Seems there is some bit-fiddling that might work for you, maybe even a probability for it to be included later in the 4.3 SDK???