mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-06 18:57:12 +00:00
Fixed: Before this PR, imagesize would provide image size in points (that is, taking care of the image resolution) instead of pixels (#2965)
This commit is contained in:
@@ -22,9 +22,16 @@ int getImageSize(const char* utf8Path, BOOL appendLineFeed)
|
||||
if (!image)
|
||||
return kErrInvalidPath;
|
||||
|
||||
NSSize size = [image size];
|
||||
|
||||
NSMutableString* result = [NSMutableString stringWithFormat:@"{\"width\":%g, \"height\":%g}", size.width, size.height];
|
||||
NSArray *representations = [image representations];
|
||||
|
||||
if ([representations count] == 0)
|
||||
return kErrInvalidPath;
|
||||
|
||||
NSImageRep *representation = representations[0];
|
||||
NSInteger width = [representation pixelsWide];
|
||||
NSInteger height = [representation pixelsHigh];
|
||||
|
||||
NSMutableString* result = [NSMutableString stringWithFormat:@"{\"width\":%ld, \"height\":%ld}", (long)width, (long)height];
|
||||
|
||||
if (appendLineFeed)
|
||||
[result appendString:@"\n"];
|
||||
|
||||
Reference in New Issue
Block a user