Fix: Error when using setImage:forKey on Mac OS

[[anImage representations] objectAtIndex:0] returns an NSCGImageSnapshotRep
which does not respond to representationUsingType:properties
and leads to this error
[NSCGImageSnapshotRep representationUsingType:properties:]: unrecognized selector sent to instance.

Plus, NSCGImageSnapshotRep seems to be private and isn't officially documented .

NSBitmapImageRep DOES respond to representationUsingType:properties.
So I create the NSBitmapImageRep from the NSImage and then use representationUsingType:properties to return the NSData.
This NSImagePNGRepresentation method could/should be in an NSImage Category.