Re: Storing an NSImage File
Re: Storing an NSImage File
- Subject: Re: Storing an NSImage File
- From: Gordon Apple <email@hidden>
- Date: Sat, 03 Aug 2013 20:38:04 -0500
- Thread-topic: Storing an NSImage File
The first thing I try is to get a url from the pasteboard. Then I create a
File object in CoreDate and copy the file at that url into my media folder,
in the same package as the CoreData file. I store the original name in the
File object, but store the file with a unique number-name and the original
file extension. I convert it back to an NSImage when displaying. When
storing, I compute and store the file hash and if matches one already in the
database, I just create another reference to the File object, instead of
storing the same image multiple times.
Unfortunately, not everything comes in as a url. In a particular case, it
comes in as an NSImage containing a PDF rep. I now store that as a pdf
file. The other problem I¹m still working on, is that these particular pdfs
contain a dictionary called ³pieceInfo² which I need to access to see if it
is a file which is editable from its original image source (and also prevent
me from re-referencing prior stored copies). So far, I¹ve not found a way
to access this via Cocoa. I¹m looking for something that will let me parse
the pdf enough to recover that ³pieceInfo² dictionary.
On 8/3/13 5:16 AM, "Graham Cox" <email@hidden> wrote:
>
> On 02/08/2013, at 6:23 PM, Gordon Apple <email@hidden> wrote:
>
>> > As a last resort, I just archive the NSImage as a private type,
>
>
> Never do this! Not only is it inefficient, it isn't guaranteed to actually
> work - images that come from the picture taker for example, cannot be archived
> and dearchived successfully as they use a private representation internally.
>
>
> --Graham
>
>
_______________________________________________
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