Re: NSImageView Will Not Alias Images
Re: NSImageView Will Not Alias Images
- Subject: Re: NSImageView Will Not Alias Images
- From: Chris Tracewell <email@hidden>
- Date: Mon, 12 Apr 2010 08:59:59 -0700
On Apr 6, 2010, at 8:16 PM, Ken Ferry wrote:
This was once true, but is out of date. I'd like to see a test
app. For example, how do you know you aren't getting
antialiasing? It may be that you just don't like the output. :-)
Well - NSImageInterpolationHigh and NSImageInterpolationNone produce
the same exact result - screen shot copy (control-command-shift-4)
the imageView built once using NSImageInterpolationHigh and once
using NSImageInterpolationNone then paste each into a Photoshop
layer, align them perfectly and then turn the top layer off and on
at 800% and there is not a single pixel that moves or changes color.
The dropped image is roughly 1000 x 1000 (a screen shot PNG) and the
imageView size is 200x200
To make sure the currentContext was correct - I log
[[NSGraphicsContext currentContext] imageInterpolation] for each
build and it shows the correct values 3 and 1 respectively. And then
just to be super sure I I log [[NSGraphicsContext currentContext]
isDrawingToScreen] inside drawRect of my NSImageView subclass and
get YES.
I did implement my own image sizing in drawRect and then used [self
setImage] and it works great. Not sure what could be the issue.
It would also be good to know what OS you are working on.
-Ken
I'm using 10.5.8. - XCode 3.1.2 - iMac Core 2 Duo and the app is GC.
What Jens is saying is probably true in 10.5, not in 10.6.
Nevertheless, I would be interested to see a test app.
-Ken
Cocoa Frameworks
Thought I'd add some closure to this, even though it's a week later. I
believe Ken's original assessment to be accurate - that I am just not
happy with the resampling that NSImageView is doing. Using larger
images with lots of detail, like a screenshot, the problem is more
pronounced, the same is true for images with thin diagonal lines. More
organic images that aren't too big produce acceptable results.
Of note, I tested an image in Photoshop that was struggling in the
ImageView and found that by sizing to the same size as the ImageView
using, "Nearest Neighbor" as the sampling method, resulted in
identical "distortion" or lack of smoothness per se. Nearest Neighbor
has been a resampling method in PS for as long as I can remember, but
I isn't really an anti-alias resampling method - it chooses the pixel
values by proximity and duplicates it - thus no new color values get
produced. I have used it in the past when needing to take, for
example, a small bit icon or type element that I want to enlarge
without aliasing, to keep a pixel accurate representation at a larger
scale. Using this method to downsize will give mediocre results at best.
All of that to say, it seems that an NSImageView in <= 10.5 you'll be
getting that method for resampling - so yes it resamples, but the
method is not optimal.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden