UIGraphicsGetImageFromCurrentImageContext返回低分辨率图像

时间:2014-09-15 05:37:46

标签: xcode uiimage uigraphicscontext

我有两个高分辨率图像,我使用UIGraphicsGetImageFromCurrentImageContext drawInRect进行合并。但该方法返回低分辨率图像。请帮忙。这是我的代码。

UIGraphicsBeginImageContext(CGSizeMake(phoneSize.width, phoneSize.height));
  for(int x=0;x<arr_UIImages.count;x++){
    NSValue *point = [app.arr_boxPositions objectAtIndex:x];
    NSValue *size = [arr_cropSizes objectAtIndex:x];
    CGPoint p = point.CGPointValue;
    CGSize s = size.CGSizeValue;
    s.width = s.width * phoneSize.width;
    s.height = s.height *phoneSize.height;
    p.x = p.x * .01;
    p.y = p.y * .01;

    p.x = p.x *phoneSize.width;
    p.y = p.y *phoneSize.height;

    float xPos = p.x - (s.width/2);
    float yPos = p.y - (s.height/2);
    UIImage *temp = [arr_UIImages objectAtIndex:x];
    [temp drawInRect:CGRectMake(xPos*2,yPos*2,temp.size.width, temp.size.height)];
  }

  UIImage *finalImage = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();
  UIImageWriteToSavedPhotosAlbum(finalImage , nil, nil, nil);

我的图像的宽度和大小是正确的,但图像的dpi很低。请帮忙。先感谢您!

0 个答案:

没有答案