• 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
Re: NSImage & Multi-Page TIFF?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage & Multi-Page TIFF?


  • Subject: Re: NSImage & Multi-Page TIFF?
  • From: "Steven O'Toole" <email@hidden>
  • Date: Wed, 13 Mar 2002 10:42:08 -0800

On Tuesday, March 12, 2002, at 06:19 PM, email@hidden wrote:

Does NSImage support Multi-Page TIFFs? If so, how would I display a
particular page?

Frankly, I'm not sure. But if it did, my guess is that each page would be read in as a separate imageRep. You could display a particular page by drawing that particular imageRep.
Give it a go and see what happens. Just read your multi-page TIFF in, and then log the NSImage to the console and see whether it contains multiple imageReps or any such thing.
Then tell all of us about what you discovered, and log a bug if necessary. :->

That seems to be the correct answer. I transferred the imageReps into an array of individual images, then assign each to an image view as the page index is requested. Below is the transferring routine. It came out pretty well considering this is my first experience with most of these classes!

Thanks to the list for the help.

////////////

- (NSMutableArray *)tiffRepsToImageArray:(NSImage *)img
{
NSMutableArray *newImages = [[NSMutableArray alloc] init];
NSEnumerator *e = [[img representations] objectEnumerator];
id rep;
while (rep = [e nextObject]) {
if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
NSImage *newImage = [[NSImage alloc] initWithData:[rep TIFFRepresentation]];
[newImages addObject:newImage];
[newImage release];
}
}
return [newImages autorelease];
}
_______________________________________________
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.
References: 
 >Re: NSImage & Multi-Page TIFF? (From: email@hidden)

  • Prev by Date: Re: NSTextField refreshes are wacky.
  • Next by Date: Subclassing NSImageRep for preexisting types
  • Previous by thread: Re: NSImage & Multi-Page TIFF?
  • Next by thread: Special behaviour for a Save/Open Panel
  • Index(es):
    • Date
    • Thread