• 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
Re: remove alpha channel from bitmap
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: remove alpha channel from bitmap


  • Subject: Re: remove alpha channel from bitmap
  • From: email@hidden
  • Date: Wed, 30 Apr 2003 19:35:02 +0200

On mercredi, avril 30, 2003, at 01:20 PM, Jason Alexander wrote:

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?

Maybe it's easier to just use QuickTime and its import/export features. There must be at least one sample code on this topic on the ADC site.
_______________________________________________
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.
References: 
 >remove alpha channel from bitmap (From: Jason Alexander <email@hidden>)

  • Prev by Date: Re: [ANN] poof image Apple sample code
  • Next by Date: RE: Updating the .m and .h file
  • Previous by thread: remove alpha channel from bitmap
  • Next by thread: Displaying images in an outline view
  • Index(es):
    • Date
    • Thread