Re: NSImage question
Re: NSImage question
- Subject: Re: NSImage question
- From: marcocoa <email@hidden>
- Date: Fri, 25 May 2007 23:43:46 +0200
Nope, Preview does not display it any more correct than your app or
XCode. I would guess the image is not at 72 dpi. You must be aware of
the fact, that [image size] or [imageRep size] gives you the size it
is *displayed* on the current device, i.e. the screen. The screen is
assumed to be 72 dpi, so that makes 1.8" x 2.4" for your image (given
its "size" of 129.6 x 172.8). You need to ask for [image pixelsWide]
and [image pixelsHigh] to get the pixel dimensions which will be 180
x 240. Now you know that you have 180 pixels in 1.8 inches, that
means, your original image had a resolution of 100 dpi.
In your case, try drawInRect:fromRect:operation:fraction: with the
destination rect set to 180x240!
--marcocoa
Am 25.05.2007 um 08:32 schrieb Oscar Bascara:
Hi All,
Here is an NSImage puzzle. I've got an image that I dragged from a
web page to the desktop. The image gets saved as a jpg file, but it's
behaving strangely. In Preview, the jpg file displays fine. It has
size 180 x 240 (just as it is shown in the web page). But then I try
to display the image in a program a usual way:
image = [NSImage imageNamed:@"image_file"];
[image compositeToPoint:point operation:NSCompositeSourceOver];
The image is drawn smaller for some reason. Checking the image
representation size, I get 129.6 x 172.8. Also, the image quality is
not as good, especially if I try rescaling it to 180 x 240. Viewing
the image in the Xcode editor, by the way, also gives this weird,
smaller display size. Somehow Preview knows how to display the image
correctly.
Any idea what is going on?
Oscar
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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