18

antialiasing in UIImage scale to fit

is there any way to disable antialiasing when scaling images in uiimage? thanks

Rakka Rage
  • 12,991
  • 6
  • 31
  • 44
  • 9
    For google's sake, this is also called bitmap smoothing, anti aliasing, sampling, upsampling, downsampling, resampling, and making pixels sharp when scaling or a scale transform is applied. =) – Jeff Ward Feb 14 '12 at 22:58

2 Answers2

36

Add the QuartzCore framework to your project, then set the image view’s layer’s magnificationFilter property to kCAFilterNearest.

Noah Witherspoon
  • 56,657
  • 16
  • 129
  • 131
2

I was working with SpriteKit in Xcode 11 (Swift 5) and also got this problem. To solve it (i.e. disable anti-aliasing) i did the following:

texture?.filteringMode = SKTextureFilteringMode.nearest
Reitenator
  • 905
  • 9
  • 11