19

antialiasing in UIImage scale to fit

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

Rakka Rage
  • 15,941
  • 8
  • 33
  • 45
  • 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

37

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

Noah Witherspoon
  • 57,021
  • 16
  • 130
  • 131
3

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
  • 1,075
  • 13
  • 13