Click here to Skip to main content
12,079,489 members (65,422 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C++ C Windows Linux file image , +
Hi all,

I am looking for a free portable library to read images files in the most common formats from a C++ program: Bmp, Png, Tiff and Jpeg are a must.

The library must be usable under Windows / Visual C++ as well as Linux Ubuntu / gcc (Eclipse). Can be precompiled or source code.

I need a proven solution that works under these environments.

I know that there is ImageMagick. I am busy trying FreeImage (but facing a few issues). There are plenty of other solutions that I have no time to try individually. Nor do I want to integrate the individual packages that are provided for these formats.

Can you advise me of something you have used personally and that meets my requirements ?

Thanks a lot
Posted 16-Nov-12 4:19am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

ImageMagick would do the trick, have a look at:
ImageMagick: Convert, Edit, Or Compose Bitmap Images[^] and Magick++ C++ API[^] - it's a great package.

Best regards
Espen Harlinn
  Permalink  
Comments
YvesDaoust 16-Nov-12 9:43am
   
Thanks.

Will it integrate seamlessly ? I think it is overfeatured compared to my needs.
Espen Harlinn 16-Nov-12 9:45am
   
It's pretty easy to use, if that's what you mean ...
YvesDaoust 16-Nov-12 10:44am
   
yes, I mean no compilation issues, no need to fetch extra headers files, adjust linker settings, read endless manual...
Espen Harlinn 17-Nov-12 5:55am
   
This is usually a no-hassle operation :-D
Have a look at: http://www.imagemagick.org/script/binary-releases.php
Sergey Alexandrovich Kryukov 19-Nov-12 18:35pm
   
Using this API is a good idea, a 5.
--SA
Espen Harlinn 19-Nov-12 18:35pm
   
Thank you, Sergey :-D
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

In the end, I have used FreeImage and made it run under Windows and Linux Ubuntu, both 32 and 64 bits. For some reason, I couldn't compile the source code under Linux and had to rely on the self-building package. Anyway, FreeImage gave me all the services I expected. Two to three days of work in total for integration and mastership.

Since then, I have also integrated genuine packages for Jpeg and Png in another application (IJG JPEG-9a and Lib Png-1.6.2). I have not used them to full power (this takes a lifetime), but the sources compiled seamlessly under Windows and Linux. You need to find good sample programs to assemble a running solution.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

I dont know about ImageMagick but I am using GDI+ for windows. I dont think so it works for Linux. And FreeImage is good library which work in both windows and Linux.
  Permalink  
Comments
YvesDaoust 21-Nov-12 2:24am
   
I tried FreeImage and it didn't compile under Windows unless I fixed the code. Then I tried a test program and it didn't link because of a missing function. Though I was trying the Windows-ready package for Visual Studio.

How can I trust a package in such conditions ?
rswapna28 22-Nov-12 1:12am
   
I used FreeImage library for loading images. It worked fine for me. I don't know why it didn't compile for you.

If you have trouble in using FreeImage, just try looking this example. you might get some help from it.
http://www.codesampler.com/usersrc/usersrc_6.htm
(Texture loading with FreeImage - OpenGL/C++)
Download this example and check.
YvesDaoust 22-Nov-12 6:46am
   
I confirm that using FreeImage is not a seamless experience.

One of the failures of the test program is a source file not included in the project ! You wonder if the package was tested before release.

Another is a runtime error message you get when trying the same test program and using the test images: "*** TIFF Format
Error while opening TIFF: data is invalid ***"

Yet another, more annoying issue is the assertion error at run-time when running under Linux: Assertion `sizeof(uint64)==8' failed.

I guess I'll find my way through, but this is exactly the kind of time-wasters I wanted to avoid...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160212.1 | Last Updated 4 Jun 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100