• 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
SOLVED: floating point NSBitmapImageRep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SOLVED: floating point NSBitmapImageRep


  • Subject: SOLVED: floating point NSBitmapImageRep
  • From: "roberto toro" <email@hidden>
  • Date: Wed, 1 Aug 2007 09:28:06 +0100

Hi all,

I found a solution for the problem: if I obtain the TIFF data directly
from the NSBitmapImageRep insted of from the NSImage, everything works
correctly :)

So, just changed [img TIFFRepresentation] by [bmp TIFFRepresentation],
deleted all the NSImage stuff, and presto :-)

cheers,
roberto


>FROM : roberto toro
>DATE : Thu Jul 26 11:59:55 2007
>
>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

  • Prev by Date: Re: appendBytes memcpy
  • Next by Date: Launching a process with Admin Privileges asynchronously
  • Previous by thread: Change dragged image
  • Next by thread: Launching a process with Admin Privileges asynchronously
  • Index(es):
    • Date
    • Thread