Currently there is no way of displaying an NSImage from a Cocoa program in a WebView (such as buddy icons in Adium's webkit message view) except writing it out to a file, creating a DOMHTMLImageElement, and setting the src attribute to the path of the image file. It would be both more convenient and more efficient to have a way of directly using the NSImage to create the DOMHTMLImageElement.
Well, it's also possible to uuencode the image data, and set the src as a data url. But I agree, that's pretty inelegant.
(In reply to comment #1) > Well, it's also possible to uuencode the image data, and set the src as a data url. Not really that practical in Adium's WKMV. A buddy icon may appear hundreds of times in a single chat (most message-view styles have the buddy icon once per contiguous run of messages; such runs are usually small, 1-2 messages typically). Depending on the icon, that's a lot of data to add into memory each time. A way to do a proper image reference would conserve huge amounts of memory versus that solution, because it could take advantage of caching.
Just FYI this would be a very nice feature to add to the API.
> it's also possible to uuencode the image data, and set the src as a data url Alternatively, the client could serve image data using a custom protocol.
(In reply to comment #4) > Alternatively, the client could serve image data using a custom protocol. Can you elaborate on that?