It's easy to get confused between UIImage , CGImage and CIImage . The difference is as follows:
UIImage: A UIImage object is a high-level way to display image data. You can create images from files, from Quartz image objects, or from the raw image data that you receive. They are immutable and should indicate image properties during initialization. It also means that these image objects are safe to use from any stream. You can usually take an NSData object containing a PNG or JPEG representation JPEG and convert it to a UIImage.
CGImage: A CGImage can only represent bitmaps. Operations in CoreGraphics, such as blending modes and masking, require CGImageRefs . If you need to access and modify the actual bitmap data, you can use CGImage . It can also be converted to NSBitmapImageReps .
CIImage: A CIImage is an immutable object representing an image. This is not an image. It has only image data associated with it. It has all the information needed to create an image. You typically use CIImage objects in conjunction with other Core Image classes such as CIFilter , CIContext , CIColor and CIVector . You can create CIImage objects with data provided from a variety of sources, such as Quartz 2D images, Core Videos, etc. You must use various optimized Core Image GPU filters. They can also be converted to NSBitmapImageReps . It can be based on a processor or GPU.
In conclusion, UIImage is what you are looking for. Causes:
Code samples would be added, but all these are the main questions that Stackoverflow has already answered, so it makes no sense. Not to mention adding code, this will make it unnecessarily large.
Summary Credit: Randall Leung
source share