getting colors from pixels

B

BlueJ774

I'm looking for a c++ library I can use to ascertain the RGB value of
a given pixel of an image I've loaded in. I've tried Magick++ without
much luck and libpng looks a little too low-level for what I'm trying
to do. I know there must be a library out there that will do what I'm
looking for. I'm sure I'm not the first person to need such a
facility. I'll be dealing mainly with PNG files and occasionally
JPEG, but lack of JPEG support isn't a deal-breaker. I'd very much
prefer it to exist within the Debian/Ubuntu standard repositories and
I'd like there to be at least a Windows version of the lib if not a
MacOS one as well.

Anyone know of any suitable libs?
 
V

Vaclav Haisman

BlueJ774 wrote, On 3.2.2009 6:47:
I'm looking for a c++ library I can use to ascertain the RGB value of
a given pixel of an image I've loaded in. I've tried Magick++ without
much luck and libpng looks a little too low-level for what I'm trying
to do. I know there must be a library out there that will do what I'm
looking for. I'm sure I'm not the first person to need such a
facility. I'll be dealing mainly with PNG files and occasionally
JPEG, but lack of JPEG support isn't a deal-breaker. I'd very much
prefer it to exist within the Debian/Ubuntu standard repositories and
I'd like there to be at least a Windows version of the lib if not a
MacOS one as well.

Anyone know of any suitable libs?
I don't see what's wrong with libpng or Magick++. They certainly let you get
RGB values for your image's pixels. Maybe if you could describe what you are
doing in more detail, somebody could propose a better tool/library.
 
B

BlueJ774

I've tried libgd, which gets the job done, but doesn't play nice with C
++ since it's written from a C paradigm. I've tried cimg, but it has
such crazy overhead. I just want a small portable library or even
just a header that will allow me to open JPEG and PNG and grab RGB
data for each individual pixel. Any ideas?
 
M

Michael DOUBEZ

BlueJ774 said:
I've tried libgd, which gets the job done, but doesn't play nice with C
++ since it's written from a C paradigm. I've tried cimg, but it has
such crazy overhead. I just want a small portable library or even
just a header that will allow me to open JPEG and PNG and grab RGB
data for each individual pixel. Any ideas?

Have you tried Boost.GIL ? It is a header-only part of Boost that allows
importing png and jpg (provided you have libpng and libjpg installed).
The learning curve is a bit harsh but the examples should get you
started quickly for something so simple.

I have used it to generated images from topographic raw data and it
worked like a charm. A very powerful and well abstracted lib IMHO even
if the semantic is verbose and promote template programming rather than
plain use.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top