开发者

UIImagePNGRepresentation in monochrome

开发者 https://www.devze.com 2023-01-06 02:19 出处:网络
I\'m developing an iPod-touch app, using Objective C.I am trying to capture a drawing the user creates on the device. I am using UIImagePNGRepresentation to captu开发者_开发知识库re the data in PNG fo

I'm developing an iPod-touch app, using Objective C. I am trying to capture a drawing the user creates on the device. I am using UIImagePNGRepresentation to captu开发者_开发知识库re the data in PNG format.

I want to change the PNG data: specifically I need to change it to a monochrome image. How do I go about changing its bit depth to 1?

Regards, Brian


See this answer here for accessing the pixels.

Then, I would iterate over the data, setting the values to 0xFF.. or 0x00.. depending on a threshold.

-S!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号