Re: TIFFRepresentation giving me a tiff WITH an alpha
Re: TIFFRepresentation giving me a tiff WITH an alpha
- Subject: Re: TIFFRepresentation giving me a tiff WITH an alpha
- From: Ben Mackin <email@hidden>
- Date: Thu, 14 Nov 2002 12:32:12 -0800
On 11/13/02 8:27 PM, "Scott Anguish" <email@hidden> wrote:
>
I'm not sure how youc an get alpha in the final image if you don't
>
have alpha enabled in the bitmapimagerep
Well after doing some testing, it looks like it is ignoring what I tell the
NSBitmapImageRep to be. Somewhere along the line, it is getting overwritten
and using some different values.
Using the following code:
tempImagRep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:NULL
pixelsWide:[image1 size].width
pixelsHigh:[image1 size].height
bitsPerSample:8
samplesPerPixel:1
hasAlpha:NO
isPlanar:NO
colorSpaceName:NSCalibratedWhiteColorSpace
bytesPerRow:0
bitsPerPixel:0];
[tempImagRep setSize:[image1 size]];
NSImage *myImage2 = [[NSImage alloc] initWithSize:NSMakeSize([image1
size].width, [image1 size].height)];
[myImage2 addRepresentation:tempImagRep];
[myImage2 lockFocusOnRepresentation:tempImagRep];
[image1 compositeToPoint:NSMakePoint(0, 0) operation:NSCompositeCopy];
[myImage2 unlockFocus];
Something in there resets my NSBitmapImageRep, because I am getting a RGB
image WITH an alpha channel (when I should be getting a 1 channel greyscale
image...) Even if I have it set to samplesPerPixel=3 and
colorSpaceName=NSCalibratedRGBColorSpace, I still get the alpha channel.
I also tried using drawInRect (instead of compositeToPoint) to see if that
made a difference, but I get the same result.
So if anyone has some thoughts on how to save an image with no alpha, please
speak up. I am totally at a loss now.
Thanks,
Ben
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.