At 03:26 -0700 16/08/08, [EMAIL PROTECTED] wrote:
>From: Matt <[EMAIL PROTECTED]>
>Date: Fri, 15 Aug 2008 13:54:32 -0700
>Message-ID: <[EMAIL PROTECTED]>
>Subject: Problem with NSImage and .PNG file
>Message: 4
>
>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.
>...
>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?

It's a bug in the image itself, or rather, in the generating software. I have a 
bug filed (still open, rdar://5532687) which says, in part:
>When saving .png files, Preview 4.0(467) generates incorrect values for the 
>file's DPI.
>...
>See http://www.libpng.org/pub/png/spec/1.1/PNG-Chunks.html#C.pHYs
>The 'pHYs' chunk can specify either "unknown unit" (which makes the file 
>default to 72 dpi when opened) or "meter". Preview now seems to generate the 
>latter specification. As 72 dpi don't fit exactly into metric units, the 
>measurement is rounded up, producing the 72.009 value.
>Solution:
>When saving 72 dpi pictures, specify "unknown unit" in the 'pHYs' chunk.

I haven't checked if that has been fixed in Leopard Preview, though; I suppose 
not, as the bug's still open.

-- 
Rainer Brockerhoff  <[EMAIL PROTECTED]>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
 In their own business even sages err."
Weblog: http://www.brockerhoff.net/bb/viewtopic.php
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to