Re: Resolution of an NSImage(Rep)?
Re: Resolution of an NSImage(Rep)?
- Subject: Re: Resolution of an NSImage(Rep)?
- From: Graham Cox <email@hidden>
- Date: Fri, 6 Aug 2010 01:10:05 +1000
On 06/08/2010, at 12:57 AM, Brian Postow wrote:
> But... um, then how do i fix my imgsize? this nsimage is sometimes coming from a PDFPage with:
>
> NSData* imgData = [pg dataRepresentation];
> NSImage* img = [[NSImage alloc] initWithData:imgData ];
> is there a better way to get the data out of the PDFPage?
>
> Other times, it's coming from either a TIFF file, or raw bitmap data from a scanner.
I don't know the answer to these questions, but the essential point is that if you have an image that is, say 8.5 x 11 inches, that's the size it should be set to (expressed in points). So you need to obtain the true size from whatever image sources you're using. If the size is present within the TIFF file header for example, I'd have thought that reading it using -initWithContentsOfFile: or -initWithData: would do the right thing. (Though not all image files are necessarily well-formed).
If you only have pixel dimensions, you can't determine the true size unless you know the resolution, or vice versa. Pixel sizes alone could mean anything.
--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