4 Replies Latest reply on Jan 28, 2011 3:01 AM by Royi A

    Imitating Photoshop "Transparent" Pixels

    Royi A Level 1

      Hello.

      I was wondering how could I achieve, Mathematically, an Effect of Photoshop.

       

      Let's say you have a Layer in Photoshop.

      Selecting its Luminosity could be done by going to the Channel Window holding Ctrl and clicking the RGB Channel (You may even use the circle at the bottom of the Window).

      Now create a new Layer (Transparent) and while selection is active fill it with Black or White.

      You get semi transparent pixels.

      How can we achieve the same effect Mathimatically in Pixel Bender?

       

      Thanks.

        • 1. Re: Imitating Photoshop "Transparent" Pixels
          Kevin Goldsmith Level 3

          yeah, I'd think so, but it seems pretty straightforward to me. You know Pixel Bender pretty well, so I'm figuring that I'm misunderstanding your question.

          • 2. Re: Imitating Photoshop "Transparent" Pixels
            Royi A Level 1

            Hi Kevin,

            try the steps I described above.

            Once by filling the layer with Black and the other by filling with White.

            There's something tricky about it, it's not a classic "Luminosity Mask".

             

            Clicking on the RGB channel creates a selection by the Luminosity, that's easy to do with Pixel Bender.

            The "Filling" part, that's what I'm missing.

             

            For example if you take a pure black pixel, its Luminosity Mask is 0.

            Yet If you fill it you'll get something completely different.

            • 3. Re: Imitating Photoshop "Transparent" Pixels
              Felix Dames Level 1

              Not sure if I understand your question right but I think this is what you want !?!

               

              <languageVersion : 1.0;>

              kernel Test
              <   namespace : "Felix Dames";
                  vendor : "Felix Dames";
                  version : 1;
              >
              {
                  input image4 src;
                  output pixel4 dst;

                  void
                  evaluatePixel()
                  {
                      float4 pixel = sampleNearest(src,outCoord());
                     
                      float  luminosity = (pixel.r + pixel.g + pixel.b) / 3.0;
                     
                     
                      dst = float4(1.0,1.0,1.0, luminosity);    // here you can change the fill color
                  }
              }

              hope it helps

              • 4. Re: Imitating Photoshop "Transparent" Pixels
                Royi A Level 1

                Worked like a charm, Thank you.

                 

                I thought about it and for some reason never gave it a try.