One Quickie


Saving an image as a file (NSImage->General)
To save an imageRep as a PNG file:
NSBitmapImageRep *bits = ...; // get a rep from your image, or grab from a view

NSData *data;
data = [bits representationUsingType: NSPNGFileType
             properties: nil];
[data writeToFile: @"/path/to/wherever/test.png"
      atomically: NO];
There are also TIFF, BMP, GIF, JPEG file types in addition to PNG.



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com