• 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
Troubles writing NSBitmapImageRep to gif file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Troubles writing NSBitmapImageRep to gif file


  • Subject: Troubles writing NSBitmapImageRep to gif file
  • From: Tobias Lidskog <email@hidden>
  • Date: Wed, 24 Apr 2002 19:12:51 +0200

Hi,

I'm having troubles saving gif files from NSBitmapImageRep. All my efforts result in distorted, strange images. Below is a very simple code snippet that illustrates what I'm trying to do. The documentation about this is rather sparse, and I haven't really found any sample code using this. Below I'm trying to read a gif file into an NSImage and then write the image data into another file. However when I do this foo.gif turns up about half the size (file size in bytes that is) compared to image.gif. Am I using the API incorrectly?

/Tobias


// --------
NSImage *image;
NSBitmapImageRep *rep;

image = [[NSImage alloc] initWithContentsOfFile:@"/tmp/image.gif"];
rep = [[image representations] objectAtIndex:0];
// I know rep is a NSBitmapImageRep since the original image was a bitmap

[[rep representationUsingType:NSGIFFileType properties:nil]
writeToFile:@"/tmp/foo.gif" atomically:NO];
// --------
_______________________________________________
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: Application, Home, ... folders
  • Next by Date: Re: Application, Home, ... folders
  • Previous by thread: Re: libjpeg
  • Next by thread: NSTextField becomeFirstResponder via mouse and select all text?
  • Index(es):
    • Date
    • Thread