Get the correct image width and height of an NSImage

NSImage size method returns size information that is screen resolution dependent. To get the size represented in the actual file image you need to use an NSImageRep.

Refer nsimage-size-not-real-size-with-some-pictures link and get helped


Dimensions of your image in pixels is stored in NSImageRep of your image. If your file contains only one image, it will be like this:

NSImageRep *rep = [[image representations] objectAtIndex:0];
NSSize imageSize = NSMakeSize(rep.pixelsWide, rep.pixelsHigh);

where image is your NSImage and imageSize is your image size in pixels.