• 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 an image to disk
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving an image to disk


  • Subject: Re: Saving an image to disk
  • From: Scott Anguish <email@hidden>
  • Date: Mon, 19 Dec 2005 16:03:19 -0500


On Dec 19, 2005, at 3:51 PM, Eamon Ford wrote:

This is sort of a newbie question, but how do I save an NSImage as a regular tiff image to the disk? I'm using this code to initialize the image (and "rep" is an NSBitmapImageRep):

NSData * tiffImage = [rep TIFFRepresentation];
NSImage * screenshot = [[NSImage alloc] initWithData:tiffImage];

But I don't even know if this is the best way to do it.


It is a newbie question, but I'm not sure the doc covers it well conceptually.

You can get the TIFF data for an image by asking for TIFFRepresentation from an NSImage (as you are), and then writeToFile:atomically: the NSData instance.

You could add a category to NSImage that implements a writeTIFFToFile:atomically: that encapsulates this behavior..

If you need a different representation than TIFF, then you'll need to look at NSBitmapImageRep's representationUsingType:properties:
method.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: Saving an image to disk
      • From: Eamon Ford <email@hidden>
References: 
 >Saving an image to disk (From: Eamon Ford <email@hidden>)

  • Prev by Date: Re: Using the QuickLite framework when building a Foundation tool
  • Next by Date: RE: NSBundle dynamic loading problem
  • Previous by thread: Re: Saving an image to disk
  • Next by thread: Re: Saving an image to disk
  • Index(es):
    • Date
    • Thread