How to read image?

Jul 3, 2014 at 8:21pm
I am on Windows, using Visual Studio C++ 2010 Express

Is there any class or method for GDI which could read jpg, png or bmp images? Maybe tiff too.
Jul 4, 2014 at 12:05am
Jul 4, 2014 at 9:54am
The class Image is for payed versions of Visual Studio. I have not payed version.

On Rosetta code there is some code using imglib.h
http://rosettacode.org/wiki/Read_image_file_through_a_pipe
Do you know where can I get save download of imglib?
Jul 4, 2014 at 10:38am
The class Image is for payed versions of Visual Studio. I have not payed version.
Really? I don't think so. It's GDI+ though.

Do you know where can I get save download of imglib?
They use ImageMagick:

http://www.imagemagick.org/
Jul 4, 2014 at 10:57am
coder777: then can you tell me what I must do, to include Image library in my project?
#include <image.h>
or
#include <image>
is fatal error. Do I must include some .lib file? I did not found it on the link.


Also there is written:
Applies to: desktop apps only.

I don't think I have desktop app.
Last edited on Jul 4, 2014 at 11:19am
Jul 5, 2014 at 10:41am
Finally I have found some good answer
http://stackoverflow.com/questions/694080/how-do-i-read-jpeg-and-png-pixels-in-c-on-linux
but I am surprised. When I open the lib png project, the file png.h is not class. They don't use namespace or classes to access the libpng. That looks kind of weird to me. What if I want to build program (dll library) which should use the libpng library. Will not be that problem that they don't use class?

Edit:
libpng does not use classes or namespace and has dependency on zlib.

Better library for png:
http://lodev.org/lodepng/
no dependency, uses class, clear design
Last edited on Jul 5, 2014 at 1:00pm
Jul 7, 2014 at 7:53am
Yes, those libraries exist. I'd say that ImageMagick do use them too. In any case you need to install the library and set up your project so that you can use the header and libs.

Will not be that problem that they don't use class?
No, in opposite: C++ classes are due to name mangling bound a certain compiler.

c functions can be used even from other languages.

What if I want to build program (dll library)
In case of dll you must be careful with memory. You must not free memory that is allocated within the dll and vice versa
Topic archived. No new replies allowed.