views:

40

answers:

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

A: 

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!

Stephen Furlani
Is there a way I can make the UIView's data monochrome to begin with?
brismith
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
It's a simple "pen" drawing. I'm transmitting the data and the receiver is expecting mono png.
brismith