On Dec 15, 2008, at 6:39 PM, David Duncan wrote:

On Dec 13, 2008, at 6:08 AM, Thomas Clement wrote:

Looks like this is what I need.

Now I also need to read pixel values from images on disk. For the same reason I'd like to avoid loading the entire image into memory. Is it possible to access pixel values piece by piece? I can't find how to do that using data providers.


There isn't a direct way to do this unfortunately, as the only way to read from a data provider is to obtain the entire data block. Please file a bug requesting a solution for this.

Will do.

The work around is to draw the part of the image you want to work with. You can do this with either AppKit or Core Graphics using NSBitmapImageRep or a bitmap context (created via CGBitmapContextCreate).

Alright but how am I suppose to draw a part of the image without loading the whole image from disk first? Creating a NSBitmapImageRep requires creating a NSData with the whole image. I tried using CGBitmapContextCreate but I got a malloc error again when calling CGContextDrawImage (passing a small rect to draw).

How should I do this?


Thanks!
Thomas

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to