I have an image which is inside an Image View. I want to find the color of a specific pixel (say x=10, y=20) inside the image. Working code would really help me out.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- Can not export audiofiles via “open in:” from Voic
- XCode 4.5 giving me “SenTestingKit/SenTestKit.h” f
That depends very much on the type of image :)
If you have the byte data, and you know how it is arranged, for example PNG uses RGBA then you've got a leg up.
Liberal use of all the CGImageFunctions like CGImageGetBitsPerComponent and CGImageGetColorSpace will be your guide.
To get the actual byte data, CGImageDestinationCreateWithData Creates an image destination that writes to a Core Foundation mutable data object (NSMutableData* / CFMutableDataRef)
If all of this is gibberish, start with the Quart2D Programming Guide.
Here is very simple sceleton of class to work with image as bitmap. When you create this object with
You can access any pixel at (x, y) as
RGB components at 0, 1, 2 byte so
you can both read or write pixels, for example set remove green component from pixel:
if use kCGImageAlphaPremultipliedLast pixel[3] is alpha