• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSImage initWithData: / problem with GIF images?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSImage initWithData: / problem with GIF images?


  • Subject: NSImage initWithData: / problem with GIF images?
  • From: <email@hidden>
  • Date: Wed, 2 Jan 2002 14:10:56 -0600

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?


  • Prev by Date: Re: Apple's Address Book File Format
  • Next by Date: Re: Translating filenames for command line?
  • Previous by thread: Re: Apple's Address Book File Format
  • Next by thread: Re: NSImage initWithData: / problem with GIF images?
  • Index(es):
    • Date
    • Thread