title: What is the best method for resizing an image without losing its quality?
body: <p>Actually i have used following two methods for image resize but my client says me that image quality is very poor so i want to know what should be the best method for image resizing.
  I am just taking the screenshots and send this screenshot of 480x320 size UIImage to the following function. </p>
  
  <pre><code>- (UIImage *)makeResizedImage:(CGSize)newSize quality:(CGInterpolationQuality)interpolationQuality image:(UIImage *)inImage{
      NSLog(@"OriginalImage%f",inImage.size.width);
  
      CGRect newRect = CGRectIntegral(CGRectMake(0, 0, newSize.width, newSize.height));
  
      CGImageRef imageRef = [inImage CGImage];
      // Compute the bytes per row of the new image
      size_t bytesPerRow = CGImageGetBitsPerPixel(imageRef) / CGImageGetBitsPerComponent(imageRef) * newRect.size.width;
      bytesPerRow = (bytesPerRow + 15) &amp; ~15;  // Make it 16-byte aligned
  
      // Build a bitmap context that's the same dimensions as the new size
      CGContextRef bitmap = CGBitmapContextCreate(NULL,
                                                  newRect.size.width,
                                                  newRect.size.height,
                                                  CGImageGetBitsPerComponent(imageRef),
                                                  bytesPerRow,
                                                  CGImageGetColorSpace(imageRef),
                                                  CGImageGetBitmapInfo(imageRef));
  
      CGContextSetInterpolationQuality(bitmap, interpolationQuality);
  
      // Draw into the context; this scales the image
      CGContextDrawImage(bitmap, newRect, imageRef);
  
      // Get the resized image from the context and a UIImage
      CGImageRef resizedImageRef = CGBitmapContextCreateImage(bitmap);
      UIImage *resizedImage = [UIImage imageWithCGImage:resizedImageRef];
      NSLog(@"ResizedImage%f",resizedImage.size.width);
      NSLog(@"ResizedImage%f",resizedImage.size.height);
  
      // Clean up
      CGContextRelease(bitmap);
      CGImageRelease(resizedImageRef);
  
      return resizedImage;
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>- (UIImage *)resizedImage:(CGSize)newSize
                  transform:(CGAffineTransform)transform
             drawTransposed:(BOOL)transpose
       interpolationQuality:(CGInterpolationQuality)quality {
      CGRect newRect = CGRectIntegral(CGRectMake(0, 0, newSize.width, newSize.height));
      CGRect transposedRect = CGRectMake(0, 0, newRect.size.height, newRect.size.width);
      CGImageRef imageRef = self.CGImage;
  
      // Build a context that's the same dimensions as the new size
      CGContextRef bitmap = CGBitmapContextCreate(NULL,
                                                  newRect.size.width,
                                                  newRect.size.height,
                                                  CGImageGetBitsPerComponent(imageRef),
                                                  0,
                                                  CGImageGetColorSpace(imageRef),
                                                  CGImageGetBitmapInfo(imageRef));
  
      // Rotate and/or flip the image if required by its orientation
      CGContextConcatCTM(bitmap, transform);
  
      // Set the quality level to use when rescaling
      CGContextSetInterpolationQuality(bitmap, quality);
  
      // Draw into the context; this scales the image
      CGContextDrawImage(bitmap, transpose ? transposedRect : newRect, imageRef);
  
      // Get the resized image from the context and a UIImage
      CGImageRef newImageRef = CGBitmapContextCreateImage(bitmap);
      UIImage *newImage = [UIImage imageWithCGImage:newImageRef];
  
      // Clean up
      CGContextRelease(bitmap);
      CGImageRelease(newImageRef);
  
      return newImage;
  }
  </code></pre>
  
  <p>please tell me is there any other method to resize the image without losing its quality</p>