Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: NSImage initWithData: / problem with GIF images?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage initWithData: / problem with GIF images?

Are these particular GIFs LZW compressed? There might be an issue there.


On 1/2/02 1:10 PM, "email@hidden"
<email@hidden> wrote:

> I am having trouble initializing an NSImage using the initWithData:
> method. Here is (roughly) what I am doing:
> url =[NSURL URLWithString:@"..."];
> data = [NSData dataWithContentsOfURL:url];
> image = [[[NSImage alloc] initWithData:data] autorelease];
> I am trying to read a set of images this way, all in GIF format, and it
> works for most of the files I try, but not for all. I saved the images
> that I could not process and tried to load them into Apple's Preview
> - with the same problem. The GraphicConverter application, however,
> has no problems with the file and reports it to be of type GIF87a.
> Both Preview and my own application log the following string trying to
> initialize the NSImage:
> decompress_gif: ran off the end of my bits
> Apparently, there is a compatibility issue between the data I receive
> and what NSImage thinks is the GIF format. My guess is that either some
> kind of processing needs to be done with the received data before calling
> initWithData:, or I'll have to implement a different importer for GIF
> that creates an NSImage instance.
> Is this a known issue of NSImage initWithData:, or do I have a non-
> standard GIF file that other (more tolerant) applications happen to be
> able to read? Has anyone had the same problem and can maybe point me to
> a solution?
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> Do not post admin requests to the list. They will be ignored.

Visit the Apple Store online or at retail locations.

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.