title: how to compress image in iphone?
body: <p>I m taking images from photo library.I have large images of 4-5 mb but i want to compress those images.As i need to store those images in local memory of iphone.for using less memory or for getting less memory warning i need to compress those images. </p>
  
  <p>I don't know how to compress images and videos.So i want to know hot to compress images?</p>
  
  <pre><code>    UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
  
      NSData* data = UIImageJPEGRepresentation(image,1.0);
      NSLog(@"found an image");
  
      NSString *path = [destinationPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.jpeg", name]];
      [data writeToFile:path atomically:YES]; 
  </code></pre>
  
  <p>This is the code for saving my image. I dont want to store the whole image as its too big. So, I want to compress it to a much smaller size as I'll need to attach multiple images.</p>
  
  <p>Thanks for the reply.</p>