Coding Tunes
Coding Tunes

Reputation: 73

How to display a pixel art image in Xcode 7 without it anti-Aliasing

I'm new to Xcode so please be patient with me! :)

(using Swift 2.1, OSX 10.11.2 El Capitan and Xcode 7.2 I am not using sprite kit or anything like that, I'm just using a single page application)

I'm trying to make a pixel art game but whenever I create a UIImageView and set the image to my pixel art png file, it makes the image all blurry, here is a screenshot of it:

enter image description here

as you can see in the Preview window (right) the image is crisp and clean, and in the Xcode window (left) the image is blurry and fuzzy

Can someone please tell me how to fix this?

Upvotes: 3

Views: 1260

Answers (2)

Reitenator
Reitenator

Reputation: 1155

In swift 5 you can do the following to change the filtering mode:

texture?.filteringMode = SKTextureFilteringMode.nearest

This will disable anti-aliasing for the selected texture.

Upvotes: 1

David Berger
David Berger

Reputation: 756

This should not be an issue.

  1. Check the view mode of the Image. Try setting it to center. enter image description here

You can also turn off the PNG Compression. How can I skip compressing one PNG?.

It is possible that the alpha channel is messing it up so try saving as a 24 bit PNG no Alpha or even better 8bit PNG no Alpha.

Upvotes: -2

Related Questions