I have a requirement to convert a .bmp image to a .jpg.
I have a sensor that only outputs a .bmp image, and i have to send that to another destination which only accepts .jpg.
I spent some time looking for source code to do this rahter than re-inventing the wheel, but so far am unable to find anything useful that can be used in our compiler. Most of the stuff out there is for C# and VB.
In your journeys, have any of you come across anything to do this ?
Source code to convert bmp to jpeg
Re: Source code to convert bmp to jpeg
There is a lot of stuff out there for JPEG and BMP formats in C and C++. After all, the reference libraries for these formats were originally created in C. There is a significant amount of C and C++ code out there for practically any widely-accepted file format. If you haven't found much, then you haven't been looking in the right place.
Having said that, there are at least two options I can think of right away:
1. libjpeg (http://libjpeg.sourceforge.net), an open-source C library with a liberal license (i.e. free for any use). I have only used this library with the Windows platform, but I expect it would port nicely to the Netburner platform.
2. jpeg-compressor (https://code.google.com/p/jpeg-compressor/). In lieu of a relatively large and full-featured library like libjpeg, this library puts all the code to generate jpeg files into a single C++ source file. It was written for the Windows platform, but the code should port easily to Netburner.
With either of these libraries, you'd still need to get the BMP data into shape for input into the JPEG library. BMP format is very simple, you could find a library to pull out the image data or roll one yourself.
Hope this helps!
--Mike
Having said that, there are at least two options I can think of right away:
1. libjpeg (http://libjpeg.sourceforge.net), an open-source C library with a liberal license (i.e. free for any use). I have only used this library with the Windows platform, but I expect it would port nicely to the Netburner platform.
2. jpeg-compressor (https://code.google.com/p/jpeg-compressor/). In lieu of a relatively large and full-featured library like libjpeg, this library puts all the code to generate jpeg files into a single C++ source file. It was written for the Windows platform, but the code should port easily to Netburner.
With either of these libraries, you'd still need to get the BMP data into shape for input into the JPEG library. BMP format is very simple, you could find a library to pull out the image data or roll one yourself.
Hope this helps!
--Mike
Re: Source code to convert bmp to jpeg
I should add that the aforementioned jpeg-compressor project includes in the source distribution an example program that can read in a BMP and output a JPEG.
--Mike
--Mike
Re: Source code to convert bmp to jpeg
Thank mike i will look into it.
I have done this, this was the easy part. I think first i am going to look at trying to get the other end to do the conversion for me. It looks like converting the bmp to jpeg on the NB end will be to time consuming to compute the values pixel for pixel.With either of these libraries, you'd still need to get the BMP data into shape for input into the JPEG library. BMP format is very simple, you could find a library to pull out the image data or roll one yourself.
Re: Source code to convert bmp to jpeg
I have a requirement to convert a .bmp image to a .jpg.
I have a sensor that only outputs a .bmp image, and i have to send that to another destination which only accepts .jpg.
I spent some time looking for source code to do this rahter than re-inventing the wheel, but so far am unable to find anything useful that can be used in our compiler. Most of the stuff out there is for C# and VB.
I have a sensor that only outputs a .bmp image, and i have to send that to another destination which only accepts .jpg.
I spent some time looking for source code to do this rahter than re-inventing the wheel, but so far am unable to find anything useful that can be used in our compiler. Most of the stuff out there is for C# and VB.
Re: Source code to convert bmp to jpeg
Turns out, the jpeg-compressor lib works straight out of the box. I spent faaaar more time trying to get raw data to feed into it than trying to get it to actually work. Here's my rough Tiff parser and an app that will serve up Lena, converting it on the way out the door.
-Dan
-Dan
- Attachments
-
- bmp2jpeg.tar.gz
- (947.73 KiB) Downloaded 933 times
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
-
- Posts: 3
- Joined: Mon Feb 26, 2024 11:00 pm
Re: Source code to convert bmp to jpeg
Hey hi, you can use the libjpeg library to convert BMP images to JPEG format. It's a widely used library with support for various programming languages, including C and C++ and detail information check wikipedia on the other hand for jpeg compressing you can use any online application such as Jpeg Compressor.