망막 디스플레이 작업시 문제가 발생했습니다. NSImage 크기는 정확 합니다만, NSBitmapImageRep을 작성하여 파일에 쓰면 이미지 마녀의 크기는 원본 이미지의 두 배입니다. 내가 망막이 아닌 화면에서 사용할 때 그런 문제는 없습니다. 내가 이미지 작업시 망막 디스플레이 문제
- 은 내가 도면과 이미지에서 NSBitmapImageRep를 만들 내가
- 에 일부 도면을 파일 (1920 × 1080)
- 에서 NSImage를 만들
그 원인은 무엇일까요? I 화상을 열어서 편집없이 저장할 경우
NSImage *originalImage = [[NSImage alloc] initWithContentsOfURL:fileUrl];
NSImage *editedImage = [[NSImage alloc] initWithSize:originalImage.size];
[editedImage lockFocus];
//I draw here NSBezierPaths
[editedImage unlockFocus];
NSBitmapImageRep *savingRep = [NSBitmapImageRep imageRepsWithData:[editedImage TIFFRepresentation]];
NSData *savingData = [savingRep representationUsingType: NSPNGFileType properties: nil];
[savingData writeToFile:desiredFileLocationAndName atomically:no];
나는 화상의 비트 맵 표현은 픽셀 단위로 측정된다
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