Just an update - for some reason the afastrunner's code works fine on the simulator but not on the actual device (the image is still coming through blue). Anyone had a similar experience when messing around with pixel data?
ng93, your code only will get the RGB values of last pixel of the image.
And I dont recommend putting the Alloc inside a loop. That just gonna eat up your memory.
Just an update - for some reason the afastrunner's code works fine on the simulator but not on the actual device (the image is still coming through blue). Anyone had a similar experience when messing around with pixel data?
I am encountering the same issue, Did you manage to fix it?
have looked at this code and tried and it all works fine. But there is something that i dont understand and i hope you can explain it:
Why do i need to create a new bitmap context with CGBitmapContextCreate? Shouldn't creating a new UIImage with imageWithCGImage and the CGImageRef already created and manipulated at the beginning be sufficient? Why to duplicate the image and memory?
Thanks afastrunner for providing the code. Its been really helpful.
If I comment out all your filter effects within your code and run the app the image comes out blue. Why is that? How do I recreate the original image without applying any effect (just so I know how the code works before I apply custom effects).
Thanks in advance.
you need something like this (last argument is kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big):
Thanks for the quick answer. I've tried, but CoreGraphics is not present in my system?! I can see CoreAudio, Data, Foundation, Midi, Services, Video, but not Graphics?! How can that be???