Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImageQuality with CGContextSetInterpolationQuality

How effective is the CGContextSetInterpolationQuality method in Quartz?

Does it affect the quality of the image? If so, to what extent?

I can't see any difference between the interpolated and the non-interpolated image.

like image 325
Shrey Avatar asked Apr 16 '11 10:04

Shrey


1 Answers

Although this is a bit of an old question, I have recently done some benchmarking about the effects of CGContextSetInterpolationQuality and thought that its outcomes might be of interest to someone else.

In my benchmark test, I draw a set of 6 different 649x649 b&w bitmap images to build a set of 12 different jigsaw puzzle tiles. The bitmap images are scaled down by a factor of 5.0 (i.e., to 129.8x129.8) to make them fit on a 320x480 display (at retina display scale).

Run times on a 4th gen iPod touch, as reported by Instruments, are the following:

  • kCGInterpolationLow: 969 msec

  • kCGInterpolationMedium: 1690 msec

  • kCGInterpolationHigh: 2694 msec

  • kCGInterpolationNone: 545 msec

As to the visual outcome, if you compare High or Medium to Low or None, the difference is staggering. Even noticeable, IMO, the difference between None and Low; while the difference between High and Medium is not particularly noticeable in this particular test. What is clear is the difference in run times, so that in my particular case, I ended up using kCGInterpolationMedium.

kCGInterpolationNone

enter image description here

kCGInterpolationLow

enter image description here

kCGInterpolationMedium

enter image description here

kCGInterpolationHigh

enter image description here

like image 100
sergio Avatar answered Sep 21 '22 16:09

sergio