Writing an image out to a file in a cocoa app

cocoa, objective-c

Solution

If you get an `NSBitmapImageRep` from the image, that can produce PNG and JPEG. See `representationUsingType:properties:`

Problem

I have a graphics editing cocoa app on Mac OSX that produces 32 by 32 square bitmaps, I need to programatically (I cannot use the interface builder at all) output this image to either a .jpg or .png. Can anyone link me to some good resources on how I might accomplish this task?

Original source