iPhone,将UIImage修改为目标平均颜色 [英] iPhone, modify UIImage to a target average color

查看:137
本文介绍了iPhone,将UIImage修改为目标平均颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个修改UIImage的项目。
以下是我必须遵循的步骤
- 我通过在图像中取几个点并计算平均R,G和B
来提取图像的平均颜色 - 下一步是修改图像以便为修改后的图像获得新的平均值R,G和B.给出了新的R,G和B,我不知道该怎么做:
如何修改UIImage以便从现有的平均RGB值传递给给定的RGB值。

I need for a project to modify UIImage. Here are steps I have to follow - I extract the average color of the image by taking several points in the image and calculating the average R, G and B - The next step is to modify the image in order to have a new average R, G and B for the modified image. This new R, G and B is given, the thing I do not know how to do is: how to modify an UIImage in order to pass from an existing average RGB value to a given RGB value.

我不太清楚。如果不是这样,请不要犹豫。

I am not sure to be very clear. Do not hesitate to ask me if this is not the case.

预先感谢您的帮助!

问候,

推荐答案

您需要使用较低级别的Core Graphics API来访问图像的像素数据。

You will need to use the lower level Core Graphics API to access the image's pixel data.

之前有过一些问题,例如这两个问题:

There have been a number of questions on that before, like for example these two:

  • How to get the RGB values for a pixel on an image on the iphone
  • How can I modify the pixel data of a UIImage on the iPhone?

后者包含指向Apple的优质文档的链接,标题为从CGImage对象获取像素数据。

The latter contains a link to a good document from Apple, titled 'Getting the pixel data from a CGImage object'.

这篇关于iPhone,将UIImage修改为目标平均颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆