Applying transformations to NSBitmapImageRep

Posted by Adam on Stack Overflow See other posts from Stack Overflow or by Adam
Published on 2010-06-03T03:49:40Z Indexed on 2010/06/03 3:54 UTC
Read the original article Hit count: 191

Filed under:
|

So ... I have an image loaded into an NSBitmapImageRep object, so I am able to examine the contents of specific pixels via a two dimensional array. Now I want to apply a couple of "transformations" to the image, in preparation for some additional processing. If I was manipulating the image manually, in Photoshop, I would:

  1. Rotate the image
  2. Crop a portion of it and discard the rest
  3. Apply a "threshold" transformation (which essentially converts the image to black and white, based on the threshold value I provide)
  4. Resample the image to shrink it down a bit (which, although losing some image quality, will speed up the subsequent processing)

(not necessarily in that order)

Are there objective C methods available to facilitate these specific image manipulations, with the data in the NSBitmapImageRep object? If so, can someone point me to some good examples?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa