You told CG, but did not indicate your approach.
Using a drawing context or bitmap:
CGContextSetInterpolationQuality(gtx, kCGInterpolationHigh); CGContextSetShouldAntialias(gtx, true); << default varies by context type CGContextDrawImage(gtx, rect, image);
and make sure your views and their layers do not resize the image again. I had good results. Other views may affect your view or context. If this doesnβt look good, try to check alone if something really distorts your view / image.
If you draw into a bitmap, you create a bitmap with the target dimensions, and then draw it.
Ideally, you will maintain aspect ratio.
Also note that this can be very processor intensive - drawing / scaling multiple times in HQ will cost a lot of time, so instead you can create a modified copy instead (using CGBitmapContext
).
source share