Re: Scaling an NSImage to have exact pixel dimensions
Re: Scaling an NSImage to have exact pixel dimensions
- Subject: Re: Scaling an NSImage to have exact pixel dimensions
- From: Graham Cox <email@hidden>
- Date: Fri, 10 Oct 2014 15:18:37 +1100
On 10 Oct 2014, at 1:08 pm, Carl Hoefs <email@hidden> wrote:
> [oldImage setSize:NSMakeSize(640.0,480.0)];
The size of an NSImage is an abstract property that does not reflect the pixel dimensions of the representations within it. This sounds a bit odd, until you realise that images can have any resolution (including none, for PDFs), so this size is the size the image scales to, in points, when drawn in a Quartz context.
Instead you need to work with the bitmap image representation that the image holds (or create one if it doesn't have one). In fact this latter approach might be the most general and safest anyway, so you can work with PDF images, etc.
--Graham
_______________________________________________
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