Will Jessop
unread,Nov 11, 2012, 4:30:20 AM11/11/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nsmanc...@googlegroups.com
Hi all,
I'm playing around with drawing lines into an image I've loaded from
disk, then writing the result out to a file. I can load my image from
disk:
NSData *imageData = [[NSData alloc] initWithContentsOfFile:@"/tmp/sexeh.jpg"];
CIImage *image = [[CIImage alloc] initWithData:imageData];
and I end up with a CIImage. However, this made me realise I have no
real idea what the difference between NSImage, CIImage and CGImage
are. I've looked around and not found any good direct comparison of
when to use one or the another, the class Overviews don't provide much
of a clue (at least for me):
============================
An NSImage object is a high-level class for manipulating image data.
You use this class to load existing images or create new ones and
composite them into a view or other image. This class works in
conjunction with one or more image representation objects (subclasses
of NSImageRep), which manage the actual image data.
The CGImageRef opaque type represents bitmap images and bitmap image
masks, based on sample data that you supply. A bitmap (or sampled)
image is a rectangular array of pixels, with each pixel representing a
single sample or data point in a source image.
The CIImage class represents an image. Core Image images are
immutable. You use CIImage objects in conjunction with other Core
Image classes, such as CIFilter, CIContext, CIVector, and CIColor, to
take advantage of the built-in Core Image filters when processing
images. You can create CIImage objects with data supplied from a
variety of sources, including Quartz 2D images, Core Video image
buffers (CVImageBufferRef), URL-based objects, and NSData objects.
============================
When should I be using one image class over another?
Will.