0

I am trying to resize UIImage . i am taking the image and set its width to 640(for ex), and check the factor i had to use, and use it to the image height also .

Somehow the image is sometimes flips, even if it was portrait image, it becomes landscape. I am probably not giving attention to something here ..

  //scale 'newImage'
    CGRect screenRect = CGRectMake(0, 0, 640.0, newImage.size.height* (640/newImage.size.width) );
    UIGraphicsBeginImageContext(screenRect.size);
    [newImage drawInRect:screenRect];
    UIImage *scaled = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
Curnelious
  • 1
  • 16
  • 76
  • 150
  • 3
    Pay attention to `image.orientation`, it may need to be transposed. –  Mar 17 '13 at 10:07

1 Answers1

-1

Ok i have the answer but its not her. when i took the image from the assetLibrary i took it with :

CGImageRef imageRef = result.defaultRepresentation.fullResolution;

This flips the image, now i use :

CGImageRef imageRef = result.defaultRepresentation.fullScreenImage;

and the image is just fine .

Curnelious
  • 1
  • 16
  • 76
  • 150