Skip navigation.
 
mlRe: NSImage and 8 bit
FROM : Marcel Weiher
DATE : Tue Nov 30 11:56:20 2004

On 30 Nov 2004, at 08:26, Robert W. Kuhn wrote:



>
> Thank you for your help. I discovered that I have to use
> initWithBitmapDataPlanes:
>        pixelsWide:
>        pixelsHigh:
>        bitsPerSample:
>        samplesPerPixel:
>        hasAlpha:
>        isPlanar:
>        colorSpaceName:
>        bytesPerRow:
>        bitsPerPixel:
>


Why?  Why not use +imageRepWithData:

>
> Ugly code.


Yes.

> Not very handy to load first the image (to get width and
> height)
>  and the the data again.
>


Why do you need the NSImage to get the width/height

>
>

>> This is probably a cached representation, so you are getting the depth
>> of the bitmap cache.  The last time I checked NSImage discards the
>> original data unless you tell it to -setDataRetained:YES.
>>

>
> I also did try this. I always get only 32bit-Data. Also the NSImage has
> always only one NSBitmaprepresentation - the 32bit data.


You are probably still getting the cached representation with your
code.  Try logging all the representations, I think you will see that
the original image data is now present.

Marcel




--
Marcel Weiher                Metaobject Software Technologies
<email_removed>        www.metaobject.com
Metaprogramming for the Graphic Arts.  HOM, IDEAs, MetaAd etc.
        1d480c25f397c4786386135f8e8938e4

Related mailsAuthorDate
mlNSImage and 8 bit Robert W. Kuhn Nov 25, 15:29
mlRe: NSImage and 8 bit Marcel Weiher Nov 29, 21:13
mlRe: NSImage and 8 bit Robert W. Kuhn Nov 30, 09:26
mlRe: NSImage and 8 bit Marcel Weiher Nov 30, 11:56