Re: NSImage & Multi-Page TIFF?
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] initWith
Data:[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.