1

I know how to change the dpi of a NSImageRep, but I can't figure out how to make CGImage APIs reflect this change... Is there a way to make CGImage write a file which is NOT a standard 72dpi? If I set a NSImageRep to be 144dpi, when I write it to file using CGImage APIs I always obtain a 72dpi image...

Thanks a lot

user732274
  • 1,069
  • 1
  • 12
  • 28

1 Answers1

2

When you add an image to your destination with CGImageDestinationAddImage, you can pass a dictionary as the properties parameter. For this dictionary you can use all the keys specified in the CGImageProperties Reference, specifically kCGImagePropertyDPIWidth and kCGImagePropertyDPIHeight.

omz
  • 53,243
  • 5
  • 129
  • 141
  • Genius! You've indirectly answered to another question I posted a few hours ago: I asked why CGImage doesn't accept 1024px reps anymore in MacOS 10.7.4: now I know it accepts 1024px reps but ONLY if they have a resolution of 144dpi. Thank you very much! – user732274 May 14 '12 at 16:47