Re: NSTextView Image Issues
Re: NSTextView Image Issues
- Subject: Re: NSTextView Image Issues
- From: Nicko van Someren <email@hidden>
- Date: Mon, 12 Apr 2004 19:24:27 +0100
On 12 Apr 2004, at 19:12, Douglas Davidson wrote:
On Apr 12, 2004, at 10:46 AM, Nicko van Someren wrote:
So what's the proscribed way to get a suitable NSFileWrapper in the
case where the image data has not come from a file? I have a program
which makes images using the NSImage method initWithPasteboard: and
often the data in the pasteboard is not related to any specific file.
Is there some generic way to get a file out of this or do I have to
special case every paste board content type and each image type?
What you are doing in effect is writing the image out to a file. Just
like any other case where you might want to write an image out to a
file, you need to pick a file format. The file format you want may
depend on the contents of the image. You must pick the format, but
NSImage in most cases will produce the actual data.
So is there any way so get back out a copy of the data that was passed
into NSImage from the clipboard? If the data that came in was in some
lossy coding format such as JPEG then ideally I'd like to save it back
out as that same set of JPEG data. The alternatives seem to be to save
it as a TIFF, which can get very big, or re-encode it as a JPEG, which
applies a second round of lossy compression. There's no guarantee that
the NSBitmapImageRep is going to find the same quantisation points (in
fact it's pretty unlikely) so going JPEG (in clipboard) to
NSBitmapImageRep to JPEG (in file wrapper) is going to look very bad.
Is there any way to get the original data that went into NSImage back
out into my file wrapper?
Nicko
_______________________________________________
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.