JPEG loading

Started by
5 comments, last by the_edd 14 years, 6 months ago
I'm working on a mostly-personal project that requires me to load a JPEG. Here's the thing, though: I don't care much about the actual image data. Preferably I'd like to be able to tuck it away so I can dump it back into the resulting file unmodified, though in the future I might want to replace the picture data (not sure, though). What I want to do is edit some of the metadata in the image and save it. Could someone suggest a library, preferably C++ but a C one works too, that would let me be able to do this? There are only 2 restrictions: It must be free and it can't be GPL. Short version: I need a free, non-GPL C/C++ library to let me edit the metadata in a JPEG. Bonus points if it will let me change the image if I want to later.
Advertisement
libjpeg allows you to do so, but it is quite a low level library. Although documentation is included, you might want to check the code of some higher-level libraries that use it to get the feel of how it is supposed to be used, such as SFML or DevIL.
Which meta-data are you looking to change? You can't change very much at all without breaking the file.
I was hoping to change some of the metadata in the APP14 marker section, because some data gets stored there that some people would like to change. This data is stored in a semi-proprietary way (basically a derivative of Photoshop's APP14) and I'm willing to handle that myself. It's being able to handle the rest of the JPEG that's being problematic for me.
Quote:Original post by Firestryke31
I was hoping to change some of the metadata in the APP14 marker section, because some data gets stored there that some people would like to change. This data is stored in a semi-proprietary way (basically a derivative of Photoshop's APP14) and I'm willing to handle that myself. It's being able to handle the rest of the JPEG that's being problematic for me.


Then I second fcoelho's suggestion of libjpeg.
I've downloaded and am looking at libjpeg. So far the only gripe I have is that it's not C++, but I'm positive I can handle that. While I'm still here, could someone point me at a tutorial for using the library so my lazy butt doesn't have to Google it (or we could go with the "to help keep information together for the others that might read this thread" excuse)?

Edit:
Here is a nicely formatted version of the documentation included with libjpeg's download. It was good enough for me, but I've heard that others found it lacking. More tutorials would still be appreciated, specifically for read-modify-write operations.

[Edited by - Firestryke31 on October 16, 2009 3:13:50 PM]
It's a shame that there's no mailing list for the library. The current maintainer's website is http://jpegclub.org/. His email is at the bottom and he was responsive to the detailed questions I had about the library a couple of months ago.

You'll find that the vast majority of other open source JPEG libraries are wrappers around the libjpeg and so despite the library's relative opacity, it is probably your best bet.

This topic is closed to new replies.

Advertisement