Re: Problem with NSImage and .PNG file
Re: Problem with NSImage and .PNG file
- Subject: Re: Problem with NSImage and .PNG file
- From: Graham Cox <email@hidden>
- Date: Sat, 16 Aug 2008 15:01:08 +1000
PNG stores its resolution in terms of pixels per metre (If I recall
correctly) and that doesn't always fit exactly into a whole number of
dots per inch, which is what Quartz uses. Quartz is being as precise
as it can in honouring the PNG resolution, but what you really want is
to scale the image ever so slightly to fit a whole number, as you have
done.
hth,
Graham
On 16 Aug 2008, at 6:54 am, Matt wrote:
I have an image that is 7200x32 pixels, which is used to store a
series of
32x32 tiles. When drawing from this NSImage, the further towards the
end of
the image (right edge) the subrect goes, the blurrier it gets drawn.
Changing the original image file to a TIFF resulted in the subrects
being
drawn properly (clean, non-blurry). But drawing from an NSImage made
from a
.PNG, the subrects came out blurry again.
I found that the .PNG NSImage was returning a width of 7199.099
pixels,
instead of 7200. Manually setting the NSImage's width to 7200 before
drawing
fixed this issue and resulted in the correct, non-blurry
subrectangles being
drawn.
Has anyone encountered this issue before? Is this a bug within
NSImage's
handling of PNG's or could this be a problem with my image file
itself, a
DPI issue perhaps?
Any feedback or info is appreciated. Thank you,
-Matt
_______________________________________________
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