1

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 capture 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

Simon
  • 25,468
  • 44
  • 152
  • 266
brismith
  • 696
  • 3
  • 18

1 Answers1

0

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!

Community
  • 1
  • 1
Stephen Furlani
  • 6,794
  • 4
  • 31
  • 60
  • Is there a way I can make the UIView's data monochrome to begin with? – brismith Jul 06 '10 at 21:33
  • UIView's data!? uh... the only thing I can think of is creating a custom UIView subclass that overrides the `drawRect:` method and changes the colors of each object/image. If this is the effect you're looking for, and you might want to try this: http://www.iphonedevsdk.com/forum/iphone-sdk-development/9090-fade-screen-when-paused.html Other than that, not sure what you want a monochrome (black/white only, no grey) screen for. – Stephen Furlani Jul 07 '10 at 13:10
  • It's a simple "pen" drawing. I'm transmitting the data and the receiver is expecting mono png. – brismith Jul 07 '10 at 20:50