CGImage UIImage CIImage 区别
CGImage UIImage CIImage 区别
- UIImage存在于UIKit中,CGImage存在于Core Graphics中,CIImage存在于Core Image中。
- UIImage负责展示和管理图片数据,例如可以使用UIImageView展示、或者绘制到UIView、layer上等,主要在CPU上操作;
- CGImage表示图像的像素矩阵(位图),每个点都对应了图片的像素信息,主要运行在GPU上;
- CIImage包含了创建图片的必要数据,自身并不会渲染成图片,代表了图像的数据或者操作图像的流程(如滤镜),主要运行在GPU上。换句话说对于CIImage的操作并不会进行大量的图片运算,只有要输出图片时才需要转化成图片数据(推荐这一步尽量放到异步线程中操作)。
官方解释
-
Apple describes a UIImage object as a high-level way to display image data. You can create images from files, from Quartz image objects, or from raw image data you receive. They are immutable and must specify an image’s properties at initialization time. This also means that these image objects are safe to use from any thread. Typically you can take NSData object containing a PNG or JPEG representation image and convert it to a UIImage. To create a new UIImage
-
A CGImage can only represent bitmaps. Operations in CoreGraphics, such as blend modes and masking require CGImageRefs. If you need to access and change the actual bitmap data, you can use CGImage. It can also be converted to NSBitmapImageReps. To create a new UIImage from a CGImage,
-
A CIImage is a immutable object that represents an image. It is not an image. It only has the image data associated with it. It has all the information necessary to produce 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 supplied from variety of sources such as Quartz 2D images, Core Videos image, etc. It is required to use the various GPU optimized Core Image filters. They can also be converted to NSBitmapImageReps. It can be based on the CPU or the GPU. To create a new CIImage,
本文来自博客园,作者:struggle_time,转载请注明原文链接:https://www.cnblogs.com/songliquan/p/16163473.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
2015-04-18 IOS开发学习笔记013-内存管理