Re: NSImage size
Re: NSImage size
- Subject: Re: NSImage size
- From: "John C. Randolph" <email@hidden>
- Date: Mon, 3 Jul 2006 06:03:21 -0700
On Jul 3, 2006, at 5:27 AM, Cook, Mike wrote:
If I load in an image into an NSImage and ask for its size with [image
size] I get a number that includes the resolution of the image
mapped to
the resolution of the screen. This is fine for a 72 dpi image but
is not
what I want for images of higher resolution.
So for example if an image is 1280 pixels wide at a resolution of 1200
dpi the size I am given is 76.8 pixels wide. This can be calculated by
(72 dip screen) *( (1280 width) / (1200 dpi)).
My question is how can I get at how wide the image is in pixels? Can I
somehow get at the dpi of a loaded image? If I could I could work
it out
from what [image size} gives me.
The thing to remember here is that NSImage instances don't have
pixels. Some NSImageReps do. Look at the list of NSImageReps in
your NSImage, find the one you want, and send it a -pixelsHigh and a -
pixelsWide message.
-jcr
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >NSImage size (From: "Cook, Mike" <email@hidden>) |