• 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
Generating Decent GIF With Transparency from NSBitmapImageRep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Generating Decent GIF With Transparency from NSBitmapImageRep


  • Subject: Generating Decent GIF With Transparency from NSBitmapImageRep
  • From: "Steven W. Schuldt" <email@hidden>
  • Date: Fri, 6 Sep 2002 15:09:03 -0700

All:

Does anyone know what a valid "packed RGB color table" value might be for the NSImageRGBColorTable key used to generate GIF data from an NSBitmapImageRep?

The following code - my best guess - will crash an app:

imProperties = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:1], NSImageDitherTransparency, [NSArchiver archivedDataWithRootObject:[NSColor colorWithDeviceRed:1.0 green:1.0 blue:1.0 alpha:1.0]], NSImageRGBColorTable, nil];
[[(NSBitmapImageRep*)imageRep representationUsingType:NSGIFFileType properties:imProperties] writeToFile:pathForImage atomically:YES];

The following code (same as above but sans NSImageRGBColorTable key) will generate an ugly, unuseable GIF:

imProperties = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:1], NSImageDitherTransparency, nil];
[[(NSBitmapImageRep*)imageRep representationUsingType:NSGIFFileType properties:imProperties] writeToFile: pathForImage atomically:YES];

Thanks!

- Steven
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Get parent process (Carbon question)
  • Next by Date: Dealing with Very Slow NSViews
  • Previous by thread: Re: glueing together what jaguar broke addenda
  • Next by thread: Dealing with Very Slow NSViews
  • Index(es):
    • Date
    • Thread