floating point NSBitmapImageRep
floating point NSBitmapImageRep
- Subject: floating point NSBitmapImageRep
- From: "roberto toro" <email@hidden>
- Date: Thu, 26 Jul 2007 10:59:55 +0100
Hi,
I'm writting a 3D mesh viewer, and I'm trying to save the depth map as
a floating point tiff image file. This is what I'm using to initialise
the bitmap:
NSBitmapImageRep *bmp=[[[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:NULL
pixelsWide:Width
pixelsHigh:Height
bitsPerSample:32
samplesPerPixel:1
hasAlpha:NO
isPlanar:NO
colorSpaceName:NSCalibratedBlackColorSpace
bitmapFormat:NSFloatingPointSamplesBitmapFormat
bytesPerRow:0
bitsPerPixel:32] autorelease];
I obtain the depth data in a float pointer (size in bytes
Width*Height*sizeof(float)) and then, I add it to a NSImage and save
it as tiff data using:
NSImage *img = [[[NSImage alloc] init] autorelease];
[img addRepresentation:bmp];
[[img TIFFRepresentation] writeToFile:filename atomically:YES];
But when I open the image again, the format is changed to:
NSBitmapImageRep 0x381400 Size={640, 480}
ColorSpace=NSCalibratedRGBColorSpace BPS=8 BPP=24 Pixels=640x480
Alpha=NO Planar=NO Format=0
I'm I doing something wrong? What is the correct way of saving a
NSFloatingPointSamplesBitmapFormat image as TIFF?
thanks in advance!
roberto
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden