Thanks for the info guys.

The method below is working great.

On 29 Aug 2011, at 14:38, Marco Tabini wrote:

> Hi Martin—
> 
> On 2011-08-29, at 9:11 AM, Martin Linklater wrote:
> 
>> Thanks Marco. When I call representationUsingType I get this:
>> 
> 
> You need to first convert the representation to an NSBitmapImageRep, which 
> can then be converted to PNG; for example:
> 
> - (NSData *) PNGRepresentationOfImage:(NSImage *) image {
>     // Create a bitmap representation from the current image
>     
>     [image lockFocus];
>     NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] 
> initWithFocusedViewRect:NSMakeRect(0, 0, image.size.width, 
> image.size.height)];
>     [image unlockFocus];
>     
>     return [bitmapRep representationUsingType:NSPNGFileType properties:Nil];
> }
> 
> I wrote a simple app (requires Xcode 4.1 with ARC enabled) for you to try 
> out. You can grab it from here.
> 
> Cheers,
> 
> 
> —Mt.

_______________________________________________

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