在视网膜显示上工作时遇到了问题。 NSImage的大小是正确的,但如果我从它创建NSBitmapImageRep并将其写入文件,我得到的图像女巫的大小是原始图像的两倍大。在非视网膜显示器上使用时没有这样的问题。使用图像时的视网膜显示问题
- 我从文件(1920×1080)
- 创建NSImage中我做了一些图纸上
- 我从图纸图像创建NSBitmapImageRep
- 我把它写到文件
- 我得到的图像与3840X2160尺寸
是什么原因造成的?
如果我打开图像并保存它没有编辑,我得到
NSImage *imageFromFile = [[NSImage alloc] initWithContentsOfURL:fileURL];
NSBitmapImageRep *newRepresentation = [[NSBitmapImageRep imageRepsWithData:[imageFromFile TIFFRepresentation]];
NSData *savingData = [newRepresentation representationUsingType: NSPNGFileType properties: nil];
[savingData writeToFile:desiredFileLocationAndName atomically:no];
查看此答案。 http://stackoverflow.com/a/17510651/1159775 – hebinda 2016-02-03 16:00:15