简体   繁体   English

调整屏幕截图图像的大小会导致文本模糊

[英]Resizing screen shot image leads to blurred text ios

My code: 我的代码:

-(UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize
{
    UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
    [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage;
}

The first parameter is image which is screen shot my view controller. 第一个参数是图像,它是视图控制器的屏幕截图。

The second parameter newSize is actually smaller than the image size which follows the aspect ratio also. 第二个参数 newSize实际上小于也遵循宽高比的图像大小。 But the image is looks good but the text(UILabel) are some what blur . 但是图像看起来不错,但是文本(UILabel)有些模糊

How can i solve this any idea? 我该如何解决这个想法?

假设newSize为磅:

UIGraphicsBeginImageContextWithOptions(newSize, NO, image.scale);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM