• 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
NSImage and 8 bit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSImage and 8 bit
      • From: Marcel Weiher <email@hidden>
  • Prev by Date: Re: background of NSButton and NSPopUpButton
  • Next by Date: Authorisation catch-22 with NSOpenPanel
  • Previous by thread: Re: getting a list of connected displays
  • Next by thread: Re: NSImage and 8 bit
  • Index(es):
    • Date
    • Thread