| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
If I have an instance of NSImage, anImage, initialized from a PDF file, I know I can save that to a bitmap file in TIFF format via
[[anImage TIFFRepresentation] writeToFile: @"/tmp/foo.tiff" atomically: YES];
To get the bitmap in PNG format, I tried the following variant:
NSData *tiffData = [anImage TIFFRepresentation];
NSBitmapImageRep *bitmap = [NSBitmapImageRep imageRepWithData:tiffData];
[[bitmap representationUsingType:NSPNGFileType properties:nil] writeToFile: @"/tmp/foo.png" atomically: YES];
However, although Preview.app displays foo.png correctly, other apps (like GraphicConverter) don't -- all I see in GC is a black square, and an inverse of the bitmap if I choose "Show Alpha Channel."
How can I strip the alpha channel from the TIFF representation to get a "pure" PNG file (or JPEG, or BMP,...) that doesn't contain an alpha channel, so that other apps can import the bitmap?
| References: | |
| >remove alpha channel from bitmap (From: Jason Alexander <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.