Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Images in NSButton and NSImageView Blurred

I am completely stumped here; I have a series of small images I'm tinkering with and making into buttons:

enter image description here

And as you can see they are all decently crisp and sharp, and retain this when I open the png files in Preview and what not.

However, when I use them in NSButtons and NSImageViews in Interface Builder, setting Scaling to None:

enter image description here

The images become horribly blurred. What am I doing wrong? I don't know where to start and what to try; should I go back to the icons and try to make them pixel perfect? Does it have to do with anti-aliasing or something along those lines?


EDIT: For some reason, it seems as if the NSButtons and NSImageViews are loading the high resolution versions of the images, even though I'm on a normal display, which can be identified by a slight light blue stroke I added to them. For some reason, Quartz Debug does not identify these as high resolution images and there's no red tint. Removing references to the @2x images does fix the problem... but...

like image 474
Vervious Avatar asked Dec 20 '22 19:12

Vervious


1 Answers

If you check out session 245 in the WWDC 2012 videos Advanced Tips and Tricks for High Resolution on OS X in the first section on NSImage you'll find out why.

NSImage doesn't have any concept of high resolution - it just uses the smallest image that has more pixels than the space it has to fill - so if your NSImageView is bigger in dimension than your 1x image it will use the 2x image as it has more pixels.

like image 79
SteveF Avatar answered Dec 27 '22 12:12

SteveF