How to modify the pixel in image using uiimageview and display the new image in iPhone?
<p>Hi
i am new to iphone and i am making an app in which i want to change the image pixels . i am using uiimageview. i have done some of the work. the pixel data is change as i think so but it do not show the new updated image. 
here is my code</p>

<pre><code>-(void)Change{
struct pixel {
  unsigned char r, g, b, a;
 };

 UIImage *myimage = [ UIImage imageNamed:@"iphone-wallpapaer-silver-apple.jpg"];

 NSUInteger numberOfRedPixels = 0;
 NSUInteger numberOfGreenPixels = 0;
 NSUInteger numberOfBluePixels = 0;
 NSUInteger numberOfAlphaPixels = 0;
 struct pixel* pixels = (struct pixel*) calloc(1, myimage.size.width * myimage.size.height * sizeof(struct pixel));
    if (pixels != nil)
    {
        // Create a new bitmap

        CGContextRef context = CGBitmapContextCreate(
              (void*) pixels,
              myimage.size.width,
              myimage.size.height,
              8,
              myimage.size.width * 4,
              CGImageGetColorSpace(myimage.CGImage),
              kCGImageAlphaPremultipliedLast
              );

        if (context != NULL)
        {
            // Draw the image in the bitmap

            CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, myimage.size.width, myimage.size.height), myimage.CGImage);

            NSUInteger numberOfPixels = myimage.size.width * myimage.size.height;
   //NSLog(@"%d",numberOfPixels);
            while (numberOfPixels &gt; 0) {
                if (pixels-&gt;r == 255) {
                    pixels-&gt;r = 0;
     //NSLog(@"%d",pixels-&gt;r);
     numberOfRedPixels++;
                }
    if(pixels-&gt;g == 255){
     pixels-&gt;g = 0;
     //NSLog(@"%d",pixels-&gt;g);
     numberOfGreenPixels ++;
    }
    if(pixels-&gt;b == 255){
     pixels-&gt;b = 0;
     //NSLog(@"%d",pixels-&gt;b);
     numberOfBluePixels ++;
    }
    if(pixels-&gt;a == 255){
     pixels-&gt;a = 0;
     numberOfAlphaPixels ++;
    }
                pixels++;
                numberOfPixels--;
   }

   context = CGBitmapContextCreate((void*)pixels,  
           myimage.size.width,
           myimage.size.height, 
           8,  
           myimage.size.width * 4,
           CGImageGetColorSpace(myimage.CGImage),
           kCGImageAlphaPremultipliedFirst );
UIImage *newImage   = [UIImage imageWithCGImage:context];
CGImageRef imageRef = CGBitmapContextCreateImage (newImage);   
}
</code></pre>
