简体   繁体   中英

Iphone App Color to black&White Image RGB Value

Currently i am working on Iphone app similar to http://itunes.apple.com/us/app/color-splash-free/id385504846?mt=8 in which we can make some or full portion of pic as black and white.

Please check the attach image for more detail. 通过摩擦任何部分的黑白图像

实际形象

I just want to know that how i can start it.I am familiar with paint app.Is this any rgb Value of any color or Its gray scale overlapping of an image with actual image at background or hide some portion of actual image and show grayscale image in that part.

Please share any code if you have that.

Thank you

Can't offer a concrete answer but a general approach from doing something similar.

What you have in 32 bit image is 4 channels of pixel information: red pixels, green pixels, blue pixels and alpha value for each pixel.

A gray image as you know from using any paint program is when all three colour components red, green and blue have equal intensity value.

Eg

rgb value of (0.5,0.5,0.5) would be halfway between black and white.

What I can suggest is you looking into finding where the user tap the screen, take rectangular sample of pixels from the touch point into memory loop through all the sample pixels and set their red, green and blue value to be equal, then redraw the newly modified image onto the view again.

If you want to quickly convert an entire image to grayscale, you can use GPUImageFramework by Brad Larson? (apologies if I misspelled your name Brad :P).

You can use his GrayScaleFilter class to generate a grayscale image.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM