representationUsingType:NSBMPFileType == nil
representationUsingType:NSBMPFileType == nil
- Subject: representationUsingType:NSBMPFileType == nil
- From: Lorenzo <email@hidden>
- Date: Thu, 13 Nov 2003 12:30:18 +0100
Hi Florent,
I have the same problem, and even with the Andrew's suggestion, I cannot
find the APIs to solve the problem by myself. How to copy over just the RGB
values? Any sample code? This is what I did and it works for all of the
other NSBitmapImageFileType(s) but for the "NSBMPFileType".
id rep = [[[NSBitmapImageRep alloc] initWithData:
[myImage TIFFRepresentation]] autorelease];
id iconFormatRep = [rep representationUsingType:
NSBMPFileType properties:nil];
When I use NSBMPFileType, iconFormatRep is always nil;
Thank you.
Best Regards
--
Lorenzo
email: email@hidden
On Sep 30, 2003, at 6:10 AM, Florent Pillet wrote:
>
Hmm after checking the archives, it looks like I'm hitting the
>
"NSBMPFileType doesn't really work" problem. If I get a NSPNGFileType
>
representation, everything works fine. However, NSBMPFileType always
>
return nil. Grr.
The BMP creation code is very limited. Make sure the bitmap is 8 bit
RGB or greyscale, no alpha, no extra components, non-planar.
-initWithFocusedViewRect: may return an image with an alpha channel and
if so, the conversion to BMP won't work and you'll get NULL back. If
there is alpha, allocate a new NSBitmapImageRep and copy over just the
RGB values.
Alternatively, the BMP format is quite simple and you could write it
out yourself especially if you use 8 bit samples.
Andrew
_______________________________
Andrew Platzer
Application Frameworks
Apple Computer, Inc.
_______________________________________________
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.