Re: newbie question on creating .png files
Re: newbie question on creating .png files
- Subject: Re: newbie question on creating .png files
- From: Steven Spencer <email@hidden>
- Date: Fri, 13 Feb 2009 23:54:21 +0000
To get a NSBitmapImageRep from a NSImage, have a look at the Reducer sample code at location :
http://developer.apple.com/samplecode/Reducer/listing16.html
file : ImageReducer.m
routine : BitmapImageRepFromNSImage
at the end of the file.
- Steve
>
>
>On 12.02.2009, at 17:14, Jean-Daniel Dupas wrote:
>
>>
>> Unfortunately, I don't think you can save an NSImage as a PNG (it
>> only supports the TIFFRepresentation method).
>>
>
>You can create a new NSBitmapImageRep using the TIFFRepresentation and
>use representationUsingType:properties:
>to get the PNG-data:
>
> NSData* TIFFData = [img TIFFRepresentation];
> NSBitmapImageRep* bitmapImageRep = [NSBitmapImageRep
>imageRepWithData:TIFFData];
> NSData* PNGData = [bitmapImageRep
>representationUsingType:NSPNGFileType properties:nil];
> [PNGData writeToFile: @"JAN01.png" atomically: YES];
>
>HTH,
>
>felix
>
>
>------------------------------
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden