PDA

View Full Version : Default Ubuntu image (decoding) library?



t1497f35
February 25th, 2012, 06:16 AM
Hi,
I need to read and decode different image files (jpg, png, gif etc) to raw bytes and to be able to query for basic properties like if there's an alpha channel in the image etc.

Does Ubuntu ship by default with such a library that I could use from C++ or C?

Bachstelze
February 25th, 2012, 06:23 AM
libjpeg, libpng, libgif. :)

t1497f35
February 25th, 2012, 06:37 AM
Thanks, I mean a unified library, so that I don't end up with a hard-coded list of library name -> image type. This isn't a good design imo.

alegomaster
February 25th, 2012, 05:03 PM
If you can't find an unified libary, you make an unified libary.

http://stackoverflow.com/questions/13128/how-to-combine-several-c-c-libraries-into-one

Bachstelze
February 25th, 2012, 05:07 PM
He will still have to "hardcode" (whatever he means by that) the names of the functions. I fail to see the problem in using several libraries, that's how vritually every image manipulation program does it (just use ldd on them to see it).

alegomaster
February 25th, 2012, 05:57 PM
I am guessing that he would want an universal library which contains functions which work with any image format. He does not want to use a separate function for each image type.

t1497f35
February 25th, 2012, 06:09 PM
I am guessing that he would want an universal library which contains functions which work with any image format. He does not want to use a separate function for each image type.
Bingo! (well, not necessarily _any_ image type).

For example Gdk :: Pixbuf when feeded a path to an image file decodes it no matter what type it is, then I can query the pixbuf for a few properties, like how many bits per channel and if it's got alpha.

Some Penguin
February 27th, 2012, 10:41 AM
ImageMagick may not be _default_ necessarily, but it's very common.