[Adium-devl] Feb 1 is the Adium 1.0 release date
Evan Schoenberg
evan at adiumx.com
Sat Jan 27 03:38:16 UTC 2007
On Jan 26, 2007, at 8:28 PM, Ken Ferry wrote:
> Once NSImage has really loaded the data (which may be lazy), it's
> just bytes in a certain configuration. The original format has
> been lost (unless I'm wrong, of course).
>
> However, if you can load it with NSImage, you can write it out in a
> format of your choosing. TIFFRepresentation will always write out
> tiff data.
>
> So, you could take your data, load it up with NSImage, and write it
> out as a tiff.
Good call, Ken.
Now I remember why I avoided that in the first place: we have a
series of bytes, which we know make an image. We can write them to
disk as-is, then have NSImage load it up when needed. This retains
whatever was sent. If, on the other hand, we create an NSImage, then
use a representation of it, we usually do just fine... but without
turning to some third party library, we can't write out an animated
GIF -- we'll lose the animation.
However, now that you bring up that technique, it becomes clear: It's
easy enough to check if it's an animated GIF specifically (the number
of frames will be > 1 - we already do a similar check when deciding
whether to resize a buddy icon for sending it over the 'net, since we
can't both resize and maintain animation)... so we could do the
following:
1) Check for animated GIF.
2) If YES, write out the raw data with a .gif extension
3) If NO, write out [[NSImage imageWithData:data] TIFFRepresentation]
as a .tiff file. Alternately, PNGRepresentation as a .png file...
better if we're going to be later loading that data and keeping it
around, but I don't think we do so it really doesn't matter.
-Evan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20070126/272ee9e7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20070126/272ee9e7/attachment.sig>
More information about the devel
mailing list