Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image Processing

Status
Not open for further replies.

AMiSM

Technical User
Jan 26, 2006
128
0
0
US
There are API's like ImageMagic that can do everything and make you a sandwich, but all I need to do is open a graphics file and access individual pixels. What is the simplest way to do this?
 
Perhaps you could start by telling us a list of the image file format(s) you're interested in.

--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
I'm interested in any loss-less format, compressed or not.
 
What is your graphics file extension (eg bmp, jpg, tif etc). The formats are very varied. With "any loss less format", we're none the wiser. Just pick one example format first.
 
OK,

BMP, PNG, TGA, Raw TGA

These would work. Is there an API that will let me load an image as a simple array?
 
Yes, I'm sure you could find a library for each one of them.
For example

But finding a library which does those 4, nothing more, nothing less will be hard work. For the simple reason that as soon as a library supports more than one format, the natural tendency for it is to support as many as possible (now we're back to ImageMagic).

The next problem you face is making sure that suitable libraries exist for your current/future operating system and compiler.

Also, with 4 different libraries, you're going to have 4 different APIs, with 4 different ideas as to what "a pixel" is. At least with IM you can just open the file and get a consistent look and feel from a programming point of view.

Next, are 4 file formats likely to become 5 or more formats in the future? If there is any chance of this, then go with IM (you should be already done). If not, you'll have quite a lot of work to add a new library, a new pixel format and so on.

I suppose it all boils down to where you want to invest your time.


--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top