• 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: NSImage question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage question


  • Subject: Re: NSImage question
  • From: "John C. Randolph" <email@hidden>
  • Date: Fri, 22 Jul 2005 14:14:23 -0700


On Jul 22, 2005, at 7:25 AM, Hussein Yahia wrote:



hello list,

What is the standard way of creating a NSImage from raw data ? I mean, I have a raw image, in the form of say, of a collection of bytes organized in a NSData object. How to create an NSImage from this ?



Create an NSBitmapImageRep using [[NSBitmapImageRep alloc] initWithBitmapdataPlanes:... and pass a pointer to your raw data as the 'planes' parameter. Add this rep to an NSImage instance.





There is a method of class NSImage called - (id)initWithData: (NSData *)data but I don't understand how to specify the size of the image, the number of bits per pixel etc.




No, -initWithData: assumes that the data you pass it is encoded JPEG, TIFF, or other such data.


-jcr

John C. Randolph <email@hidden> (408) 914-0013
Roaming Cocoa Engineer,
Available for your projects at great Expense and Inconvenience.





_______________________________________________
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


References: 
 >NSImage question (From: Hussein Yahia <email@hidden>)

  • Prev by Date: Re: getting bytes out of NSData
  • Next by Date: Asynchronous WSMethodInvocations
  • Previous by thread: NSImage question
  • Next by thread: NSImage question
  • Index(es):
    • Date
    • Thread