Convert image from jpg tp png

Mar 5, 2010 at 10:58pm
Hello every one
i want to convert image from jpg to png format !!!
any suggestions!!!

thanks
Mar 5, 2010 at 11:18pm
First decompress the jpg, then recompress the image using the png algorithm.
Mar 5, 2010 at 11:24pm
Look it up. This is a programming forum, and even if this is for some kind of program we don't have *all* the answers.
Mar 5, 2010 at 11:30pm
thanks jsmith


tummychow:
I think i am asking in the right place as i ask for a [b]programming guide[/b]
Mar 5, 2010 at 11:52pm
Well we don't have the libraries... have you checked online?
Mar 5, 2010 at 11:56pm
You can do what jsmith suggested using libjpeg and libpng. There are also some image manipulation libraries around (e.g. ImageMagick, FreeImage), which let you load and save with only a few function calls.
Mar 6, 2010 at 12:34am
Boost GIL rocks for this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "boost/gil/gil_all.hpp"
#include "boost/gil/extension/io/jpeg_io.hpp"
#include "boost/gil/extension/io/png_io.hpp"

int main(int argc, char* argv[])
{
    if (argc < 3) return 1;

    using namespace boost::gil;
    rgb8_image_t im;

    jpeg_read_image(argv[1], im);
    png_write_view(argv[2], view(im));
    return 0;
}


make "LDFLAGS=-lpng -ljpeg" gil

Mar 6, 2010 at 12:54am
That is pretty awesome.
There is also a utility on sourceforge called optipng which converts bmps to pngs.
Topic archived. No new replies allowed.