【发布时间】:2012-08-09 04:46:42
【问题描述】:
我使用下面的代码来获取 NSImage 的宽度和高度:
NSImage *image = [[[NSImage alloc] initWithContentsOfFile:[NSString stringWithFormat:s]] autorelease];
imageWidth=[image size].width;
imageHeight=[image size].height;
NSLog(@"%f:%f",imageWidth,imageHeight);
但有时imageWidth、imageHeight 不会返回正确的值。例如,当我阅读图像时,EXIF 信息会显示:
PixelXDimension = 2272;
PixelYDimension = 1704;
但是 imageWidth, imageHeight 输出
521:390
【问题讨论】:
标签: objective-c macos cocoa nsimage