我看到有時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