I have an 16 * 16 pixel art image which i want to use in my iOS app.
but when i select the image at my UIImageView the picture gets really blurry.
I think it has something to do with the way the image gets filtered, but i couldn't find any filtering options. I already tried changing a lot of options, but just can't get it to work
How do i fix this?
( i am using iOS 7, Xcode 5.1.1, OS X 10.9 Mavericks and a iPhone 4S (i don't think this info is needed, but just in case))
EDIT:
Here's an image: http://i.stack.imgur.com/d3Yms.png
As you can see, the image on the right in photoshop looks great, but the image on the left in Xcode looks fuzzy
The problem is that scaling procedure interpolates pixels position and size while scaling it. If you want to use sharp pixelart-images you must prepare all resources and never rely on scaling by setting
_imageView.contentMode = UIVIewContentModeCenter;
OR set scaling filters to value kCAFilterNearest
[_imageView.layer setMagnificationFilter:kCAFilterNearest];
[_imageView.layer setMinificationFilter:kCAFilterNearest];
if you like the second way, i'd recommend to set all ImageView frames with EVEN (2,4,6,8 etc) sizes and origins to avoid pixel misalign
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.