Making a filter plugin: what to do with transparent pixels??

Discussion in 'Photoshop Tutorials' started by Jace_tbl_003, Jun 30, 2005.

  1. Jace_tbl_003

    Jace_tbl_003 Guest

    Hi, I'm currently programming a filter plugin, and I'm kinda wondering
    what users would expect to happen with transparent pixels.

    A problem arises when filtering layers that are not entirely filled
    (i.e. contain transparent parts).

    Since pictures usually say more than a thousand words, please see what
    I mean here:

    Before filtering:

    After filtering:

    For simplicity, let's assume my filter just does a simple blur. Should
    I first "fix" the RGB data of the fully transparent pixels and then
    apply my filter normally? Cause if I don't, by averaging pixels I might
    end up blurring white pixels through visible areas, while the white has
    actually no meaning at all.

    Does anyone know how filters deal with this in general?
    Jace_tbl_003, Jun 30, 2005
    1. Advertisements

  2. Just use the opacity as a weight when adding values in for doing your
    blending. So opacity 0 pixels won't be considered when adding nearby
    pixels, opacity 255 pixels will work as normal.

    Nicholas Sherlock
    Nicholas Sherlock, Jun 30, 2005
    1. Advertisements

  3. Jace_tbl_003

    Sean Guest

    This could create some odd boundary artifacts for some algorithms.
    Not that I have the answer here, and this is a reasonable start, just
    be aware it is not a complete solution and could cause problems of its
    own. i.e., imagine an edge detector in a pure white image detecting
    edges due to the zero opacity. And after all, if one wanted to find
    edges in a mask, then would one not run the filter on the mask?

    So computing as normal might be better for an edge detector. But then
    ignoring such pixels also has value. i.e., try lens blur with a mask
    and you will see that masked away pixels do not affect the blur.
    Hence, one can see that the proper solution is a function of the
    problem being solved.

    hope this helps,


    "In the End, we will remember not the words of our enemies,
    but the silence of our friends."

    - Martin Luther King Jr. (1929-1968)

    New Website
    Last Updated 23 June 2005
    Sean, Jul 12, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.