• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Saving PNG files from NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving PNG files from NSImage


  • Subject: Re: Saving PNG files from NSImage
  • From: Martin Linklater <email@hidden>
  • Date: Mon, 29 Aug 2011 14:11:29 +0100

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 (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

  • Follow-Ups:
    • Re: Saving PNG files from NSImage
      • From: Mike Abdullah <email@hidden>
References: 
 >Saving PNG files from NSImage (From: Martin Linklater <email@hidden>)
 >Re: Saving PNG files from NSImage (From: Marco Tabini <email@hidden>)

  • Prev by Date: Saving PNG files from NSImage
  • Next by Date: Re: Saving PNG files from NSImage
  • Previous by thread: Re: Saving PNG files from NSImage
  • Next by thread: Re: Saving PNG files from NSImage
  • Index(es):
    • Date
    • Thread