0

I can pick the image from gallery and then crop the image but it becomes too low quality.

CGRect value=  AVMakeRectWithAspectRatioInsideRect(imageView.image.size, imageView.frame);
UIGraphicsBeginImageContext(imageView.image.size);
[imageView.image drawInRect:CGRectMake(0,0, value.size.width, value.size.height)];
UIImage *img= UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Please any one help me figure out this issue.

kb920
  • 3,039
  • 2
  • 33
  • 44

2 Answers2

0

You need to create your context with UIGraphicsBeginImageContextWithOptions, and pass In a scale of 0. The call UIGraphicsBeginImageContext does not allow for retina images.

Duncan C
  • 128,072
  • 22
  • 173
  • 272
0

Here is what I am doing in my one project:

   //*************** This one creates blury image so used contextWith options *****************************//

   // UIGraphicsBeginImageContext(CGSizeMake(signView.bounds.size.width, signView.bounds.size.height));

    UIGraphicsBeginImageContextWithOptions(signView.bounds.size, signView.opaque, 0.0);

    [signView.layer renderInContext: UIGraphicsGetCurrentContext()];
    // UIImage *imgMySignature = UIGraphicsGetImageFromCurrentImageContext();
    signView.img = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

Here I am rendering image from UIView. signView is object of UIView.

Main concern is, use UIGraphicsBeginImageContextWithOptions instead of UIGraphicsBeginImageContext.

Payal Maniyar
  • 4,293
  • 3
  • 25
  • 51
Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75