Re: multiple layers in tiff
Re: multiple layers in tiff
- Subject: Re: multiple layers in tiff
- From: Ryan Stevens <email@hidden>
- Date: Fri, 23 Jan 2004 09:23:42 -0800
On Jan 23, 2004, at 6:38 AM, Roberto Toro wrote:
>
Hi,
>
>
Is it possible to save multiple layers in a tiff file?
>
I have been trying with TIFFRepresentationWithImageRepsInArray, but I
>
think
>
it is not intended for that...
>
otherwise, I have tried creating a NSImage where I compose several
>
images
>
and then saving that as a TIFFRepresentation, but I get just one
>
layer...
>
>
Is it maybe possible with a pdf file?
>
.. should I better use libtiff?
>
>
It should be possible to "fake" layers....
// disclaimer: typed in Mail...
@implementation NSImage (Convenience)
- (NSImage *)addImageAsLayer:(NSImage *)img {
// should do sanity checking and add all of img's reps, left to the
reader.
[self addRepresentation: [[img representations] objectAtIndex:0] ];
return self;
}
- (NSArray *)imageLayers
{
NSMutableArray *contents = [NSMutableArray array];
NSImage *tmp;
NSArray *reps = [self representations];
int count = [reps count];
int i=0;
for (;i<count;i++) {
id rep = [reps objectAtIndex:i];
tmp = [[NSImage alloc] initWithSize:[rep size]];
[tmp addRepresentation:rep];
[tmp setFlipped:YES];
[contents addObject:tmp];
[tmp release];
}
return contents;
}
@end
HTH!
_______________________________________________
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.