Re: Reading multi-frame TIFF's
Re: Reading multi-frame TIFF's
- Subject: Re: Reading multi-frame TIFF's
- From: Heinrich Giesen <email@hidden>
- Date: Fri, 11 Mar 2005 11:44:34 +0100
On 11.03.2005, at 05:27, Rick Hoge wrote:
We have been looking into reading in multi-frame tiff files in an
imaging application. NSBitmapImageRep works great, but it's not
obvious how (or whether) multi-frame TIFF's are supported.
I am not sure what you mean with "multi-frame" and I did
not understand the word "multi-page" TIFF in the
"November of 2004" dicussion. There is a multipage tag in the
TIFF specifications but with a (as I understand it) very different
meaning. But as you mentioned Preview.app, I think you speak of
TIFF files with more than one image, which in Cocoa are called
representations. To get these representations you may write
NSArray *repList = [NSImageRep
<x-tad-bigger>imageRepsWithContentsOfFile:fName</x-tad-bigger>];
or similar methods. The reps can also be found with:
NSImage *img = [[NSImage alloc]
<x-tad-bigger>initWithContentsOfFile:fName];
</x-tad-bigger> NSArray *repList = [img representations];
(Remember that an NSImage is only a wrapper for zero, one ore more
representations. And remember that an NSImage draws only one of the
many representations selected by some heuristics.)
If (for depicting the reps) you need NSImages for all representations, do this
for( all reps ){
NSImage *newImg = [[NSImage alloc] initWithSoize:NSZeroSize];
[newImg addRepresentation:[repList objectAtIndex:i]];
[listOfNewImages addObject:[newImg autorelease]];
}
Creating a multi-"page" / multi-"frame" TIFF file do this
(or use a similar construct with NSImage):
NSData *tiffData = [NSBitmapImageRep
<x-tad-bigger>TIFFRepresentationOfImageRepsInArray:repList</x-tad-bigger>];
[tiffData writeToFile:nameOfATiffFile atomically:YES];
--
Heinrich Giesen
email: email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden