Thanks Marco. When I call representationUsingType I get this:

-[NSCGImageSnapshotRep representationUsingType:properties:]: unrecognized 
selector sent to instance 0x100220610
2011-08-29 14:08:16.161 TexLifter[69386:407] *** Terminating app due to 
uncaught exception 'NSInvalidArgumentException', reason: 
'-[NSCGImageSnapshotRep representationUsingType:properties:]: unrecognized 
selector sent to instance 0x100220610'

Here is my full code:

        NSSize outputImageSize;
        outputImageSize.width = dimension;
        outputImageSize.height = dimension;
        self.outputImage = [[NSImage alloc] initWithSize:outputImageSize];
        
        // Do a load of -[image drawAtPoint:fromRect:operation:fraction] calls 
to composite
        
        NSArray* reps = self.outputImage.representations;       

        NSBitmapImageRep* rep = [reps objectAtIndex:0];
        
        NSData* data = [rep representationUsingType:NSPNGFileType 
properties:nil];

*ERROR AS ABOVE*

8(

On 29 Aug 2011, at 13:59, Marco Tabini wrote:

> Hi Martin—
> 
> On 2011-08-29, at 8:18 AM, Martin Linklater wrote:
> 
>> Can anyone point me in the right direction as to how to save my NSImage to a 
>> PNG file ? Or some documentation which actually describes how to convert the 
>> NSCGImageSnapshotRep into something I can save out ? I've spent a few hours 
>> on this now and I can't believe there isn't an easy solution I'm missing.
> 
> 
> Take a look here: 
> http://stackoverflow.com/questions/4438802/nscgimagesnapshotrep-how-get-bitmapdata
> 
> HTH,
> 
> 
> —Mt.
> 
> --
> Phone: +1-416-630-6202 x.666
> Twitter: @mtabini
> 
> 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to