Re: Resolution of an NSImage(Rep)?
Re: Resolution of an NSImage(Rep)?
- Subject: Re: Resolution of an NSImage(Rep)?
- From: Brian Postow <email@hidden>
- Date: Thu, 5 Aug 2010 15:18:35 -0400
On Aug 5, 2010, at 3:07 PM, Quincey Morris wrote:
> On Aug 5, 2010, at 11:23, Brian Postow wrote:
>
>> the representations size is also in points.
>
> Well, to clarify, do you really mean "size"? I would assume that imageRep.size.width == image.size.width (both are in points), but imageRep.pixelsWide would be different, if the resolution is not 72 dpi. Did you actually check pixelsWide/pixelsHigh?
>
yes: I have the following code:
PDFPage* pdfPage = [[PDFPage alloc] initWithImage: img];
DEBUGSTR(@"I have %d pages", [doc pageCount]);
[doc insertPage:pdfPage atIndex: maxPage ];
NSData* imgData = [pdfPage dataRepresentation];
NSImage* img2 = [[NSImage alloc] initWithData:imgData ];
and in the debugger I get:
(gdb) p (int)[[[img2 representations] objectAtIndex: 0] pixelsHigh]
$1 = 611
(gdb) p (int)[[[img representations] objectAtIndex: 0] pixelsHigh]
$2 = 1696
> Incidentally, if your scenario is intentionally working with only a single image representation, then it's probably better (and, I'd say, with 10.6 definitely better) to avoid NSImage completely and stick with just NSImageRep throughout the scenario. I don't think there are any API reasons left to prefer NSImage, when multiple representations are not at issue, but others may have a more informed opinion on that subject than I do.
>
I'm targeting 10.5... I'm not sure if that matters much, but yeah... I'm also using IKImageView, and so I'm ACTUALLY targeting CGImageRef, but NSImage seems the easiest way of getting there...
>
> _______________________________________________
>
> 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
>
Brian Postow
Senior Software Engineer
Acordex Imaging Systems
_______________________________________________
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