我看到有时NSImage大小不是实际大小(有一些图片),CIImage大小总是真实的。我正在测试这image。NSImage尺寸与一些图片不是实际尺寸?
这是我写的测试代码:
NSImage *_imageNSImage = [[NSImage alloc]initWithContentsOfFile:@"<path to image>"];
NSSize _dimensions = [_imageNSImage size];
[_imageNSImage release];
NSLog(@"Width from CIImage: %f",_dimensions.width);
NSLog(@"Height from CIImage: %f",_dimensions.height);
NSURL *_myURL = [NSURL fileURLWithPath:@"<path to image>"];
CIImage *_imageCIImage = [CIImage imageWithContentsOfURL:_myURL];
NSRect _rectFromCIImage = [_imageCIImage extent];
NSLog(@"Width from CIImage: %f",_rectFromCIImage.size.width);
NSLog(@"Height from CIImage: %f",_rectFromCIImage.size.height);
和输出是:
所以怎么说也?也许我做错了什么?
感谢您的伟大壁纸! – JustSid 2012-02-13 17:53:20
@JustSid不客气:) – 2012-02-13 18:04:45