views:

138

answers:

1

I develop with XCode 3.2 under Snow Leopard, and I want to read a jpg-file from disk into memory and manipulate directly with the raw image bitmap presented as a C char array. How can I achieve this?

+3  A: 

Take a look at this http://www.cocoadev.com/index.pl?NSBitmapImageRep The trick is to get an NSBitmapImageRep from an NSImage. You can then access the underlying pixel data.

Please note that while this can be useful and fun, if you wanted to develop a sophisticated image filtering thing you would be better off with opengl, Core image or even quartz composer. Apple has a lot of sample code for all of these routes on http://developer.apple.com/

Thanks, NSBitmapImageRep did the trick!I know about the frameworks you mention, but my purpose is trying to directly manipulate image bitmaps using OpenCL. Making an OpenGL context for interoperability would also be useful.
leinz