NSImage different size in code different shown by Finder/Preview

Posted by krasnyk on Stack Overflow See other posts from Stack Overflow or by krasnyk
Published on 2010-06-07T15:37:38Z Indexed on 2010/06/07 15:42 UTC
Read the original article Hit count: 249

Filed under:
|

I have a couple of images that i use in my application(one of them is attached). The strange thing is that the real image size(shown by finder and preview) is 1200x701 px.

When I access image from the code and as for its size, I get 360x210px. What is going on?

Code I'm using to get the size of the image:


NSImage *newImg =  [[NSImage alloc] initWithContentsOfURL:
                   [NSURL URLFromPasteboard:[sender draggingPasteboard]]];
float h = [newImg size].height; //height is 210px - should be 701px
float w = [newImg size].width;  //width is 320px - should be 1200px

The content of the newImg is the same image that has been pointed and loaded - I display it in the NSImageView anyway so I see. Just the size taken with -size is wrong.

This is the image:

alt text

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about nsimage