1
我陷入了一个问题,我正在创建图像,它的大小是350 * 350,但我想调整该图像的大小像32 * 32或16 * 16这样的小图像我正在这样做代码uiimage按比例调整大小因子
UIImage *scaledImage=img_Clip;
UIGraphicsBeginImageContextWithOptions(CGSizeMake(16, 16),NO,0.0);
// Turn off interpolation to keep the scaled image from being blurred.
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
[scaledImage drawInRect:CGRectMake(0, 0, 16, 16)]; // scales image to rect
UIImage *resImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
但我没有得到期望的结果我的形象变得模糊,我尝试了许多,但事情没有工作好心帮我
您正在调整大小约5%的东西,并将所有像素数据填入16x16图标。当然它会变得有点模糊。 – coneybeare
to coneybeare的观点,大幅度缩小位图图像的大小会变得模糊,因为你失去了分辨率。如果您自己绘制图像,则可能会获得更好的重新绘制新尺寸的结果,而不是缩小更大的图像。 –
请提供我一些代码,我正在为此工作,从最后4 5天,但没有得到我想要的结果我当前的图像是350 * 350,我想使它16 * 16 –