NSImage and 8 bit
NSImage and 8 bit
- Subject: NSImage and 8 bit
- From: "Robert W. Kuhn" <email@hidden>
- Date: Thu, 25 Nov 2004 15:29:47 +0100
Hello,
can NSImage not handle grayscale (8 bit) images?
ti-pcl2:~/Programmierung/Disparity rkuhn$ file A_000_000.bmp
A_000_000.bmp: PC bitmap data, Windows 3.x format, 1280 x 1020 x 8
But:
mLeftImg = [[NSImage alloc]
initWithContentsOfFile:@"A_000_000.bmp"];
NSLog(@"BPP: %i", [mLeftImg bitsPerPixel]);
gives in the Log:
2004-11-25 15:29:03.447 Disparity[6999] BPP: 32
This is bitsPerPixel:
-(int)bitsPerPixel
{
return [[self bitmapImageRep] bitsPerPixel];
}
with
-(NSBitmapImageRep*)bitmapImageRep
{
NSArray *reps=[self representations];
NSEnumerator *enumerator = [reps objectEnumerator];
id obj;
NSBitmapImageRep *bir=nil;
// cycle through the image reps until we find a suitable one
while ((obj = [enumerator nextObject])) {
bir=nil;
if([obj isKindOfClass: [NSBitmapImageRep class]]) {
bir=(NSBitmapImageRep *)obj;
break;
}
}
return bir;
}
Mit freundlichen Grüßen
Robert W. Kuhn
_______________________________________________
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