• 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
determining format of NSImageRep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

determining format of NSImageRep


  • Subject: determining format of NSImageRep
  • From: "Mark J. Lilback" <email@hidden>
  • Date: Mon, 24 Mar 2003 19:17:07 -0500

My program has received an NSData* that contains image data. I have no idea what format. So I call [[NSImage alloc] initWithData: data] and if it returns something, I know I have a valid image.

Now I want to save this again, after the user possibly modified the image (or replaced the image with a new one). I need an NSData with the raw data in the same format as the original.

I know I can call representationUsingType:properties:, but how can I determine what the original image type was?

The best method I can see is to call [NSImageRep imageRepClassForData: data] and then look for the known classes that implement the basic types for jpg, gif, png, etc. But it seems really strange for me that there is no message that returns what format an image is. But then I also have to figure out the properties dictionary, which doesn't look fun to do.

Am I missing something here, or do I need to use QuickTime instead of AppKit for this?

Thanks.

--
__________________________________________________________________________
"They that can give up essential liberty
Mark J. Lilback to obtain a little temporary safety
<email@hidden> deserve neither liberty or safety."
http://www.lilback.com/ -- Benjamin Franklin
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: determining format of NSImageRep
      • From: "John C. Randolph" <email@hidden>
  • Prev by Date: Re: CFURLRef -> NSRURL* ???
  • Next by Date: Re: one NSPipe, multiple NSTasks?
  • Previous by thread: Re: socket sample in cocoa
  • Next by thread: Re: determining format of NSImageRep
  • Index(es):
    • Date
    • Thread