Re: Storing an NSImage File
Re: Storing an NSImage File
- Subject: Re: Storing an NSImage File
- From: Uli Kusterer <email@hidden>
- Date: Fri, 02 Aug 2013 18:55:54 +0200
On Aug 2, 2013, at 6:23 PM, Gordon Apple <email@hidden> wrote:
> I have a need to store an NSImage (possibly from a pasteboard) as standard
> file type. As a last resort, I just archive the NSImage as a private type,
> I have figured out how to recognize a NSPDFImageRep and store as a .pdf,
> which I need because of certain metadata which needs to be preserved. But
> what about NSBitmapImageRep. Is a bitmap just a bitmap, regardless of the
> original source type? If I canĀ¹t get the original type, is TIFF the most
> robust format for bitmap file storage?
The only difference between the various bitmap image formats is the space they take up on disk, and whether they use lossy or lossless compression on disk. If you want to make sure no data is lost, a losslessly compressed or uncompressed TIFF is the safest choice. But it may result in a rather large file (e.g. if the original was a JPEG). But you don't want to recompress a JPEG as another JPEG, even if you use the same settings, because *by definition* that will cause loss of data.
For what it's worth, PDF can contain bitmaps as well (even interleaved with other vector graphics), so the easiest way might be to always save as PDF, because that can store anything you throw at it. At worst you get an unnecessary PDF header around raw, uncompressed image data.
> With representationUsingType:properties, do I need to include the properties to
> get a well formed (and usable) tiff file?
I think that's essentially what -TIFFRepresentation maps to. An empty dictionary. Should be fine, unless the docs disagree. But this is from memory, someone else here might know better.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden