• 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: Finding transparent pixels in an image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding transparent pixels in an image


  • Subject: Re: Finding transparent pixels in an image
  • From: Andy Matuschak <email@hidden>
  • Date: Fri, 26 Aug 2005 11:46:34 -0500

NSColor has four values: red, green, blue, and alpha. Simply check if the last one's 1. If you're reading directly from the unsigned char * bitmap data, then the alpha value would be the last value in each group of four samples (unless the bitmap format dictates ARGB instead). Now, if your bitmap rep doesn't have four samples per pixel (check with [imageRep samplesPerPixel]), then you already know that every value in the image is opaque. Hope this helps.

- Andy Matuschak


On Aug 26, 2005, at 8:25 AM, Ron Fleckner wrote:

Hi,

I want to be able to determine if a pixel in an NSBitmapImageRep is transparent so I can change it to white. I thought I could do it if the value read from the pixel was red:0 green:0 blue:0. That actually works, but unfortunately, black pixels also give the same value, so my altered image has white not only where the original had transparency, but also where the original had pure black.

How can I tell the difference between black and transparent pixels?

Thanks for any answers/pointers/clues.

Ron
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40andymatuschak.org


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Finding transparent pixels in an image (From: Ron Fleckner <email@hidden>)

  • Prev by Date: Re: Focus ring annoyance
  • Next by Date: Re: what happend of the .hidden file in Tiger?
  • Previous by thread: Finding transparent pixels in an image
  • Next by thread: what happend of the .hidden file in Tiger?
  • Index(es):
    • Date
    • Thread