4 Replies Latest reply: Jun 11, 2010 12:07 PM by harry teasley RSS

    Better Alpha channel handling

    harry teasley Community Member

      I've asked for this a lot: alpha channel saving with PS is terrible, and could use an update. And today, I was embarrassed by a bug that caused our game engine to perform poorly as a result of the way Photoshop handles the alpha channel.

       

      The bug: make a 1024x1024 canvas, give it an opaque alpha channel (100% white, every pixel), then Image Size it down to something smaller, like 128x128. Now look at your alpha channel: grey pixels all along the border. ARRGGGHHH!!!1!1! It interpolated, I'm sure, using black alpha outside the canvas that doesn't actually exist, changing, in a powerful, fundamental way, the nature of the alpha channel. Video cards care about this stuff: 99.9% opaque is not 100% opaque. This is terrible.

       

      The request: That PS intelligently offer better defaults when saving an image with an alpha. Right now, it offers, "What was the last bit depth you saved an image to?" Regardless of the fact that the previous image may have no relationship to the following image being saved, the default offering is always "what I did last time". This enables very easy pruning of alpha channels that should be there, or adding opaque alpha channels that shouldn't be there, bloating the file size.

       

      I'd like PS to determine if an alpha channel is present, and base its default choice on that. If one is present, default to 32-bits. If an alpha channel si not present, default to 24-bits. That easy.

       

      If multiple alpha channels are present, I'd like a dropdown menu to pick which one I want. Right now, if you save a PSD with multiple alpha channels to a 32-bit TGA, it throws all alpha channels away, and saves the image with a solidly opaque alpha channel, the choice no one asked for.

       

      For texture work, or works where the graphics card is the destination, not the printed page, this cavalier handling of alpha channels is definitely not sustainable.

       

      I'd love to never have to ask for this again.

        • 1. Re: Better Alpha channel handling
          Noel Carboni Community Member

          Generally speaking the resize of an image on a layer in which the canvas is exactly the size of the data will result in transparency peeking in around the edge (i.e., I'm agreeing with you here, just using Photoshop terms).  I've always thought this was kind of poorly thought-out too.  As you say, the algorithm must default to using 0 vs., say, replicating (or "clamping") to the alpha of the pixels right on the edge.

           

          I suppose theoretically, the thinking is that if you were to EXPAND the canvas, the area around the image would be transparent anyway, and a subsequent resampling would then have the same result as the above.

           

          Knowing this, one way to work around the problem would be to create a slightly larger image, then Canvas Size it down to your intended resolution.  That way there's layer data beyond the edges with which the resizing algorithm can work.  I realize that's probably not a practical solution in general, but a trick to keep up your sleeve if you really do need that 128 x 128 image with alpha solid to the edge.

           

          -Noel

          • 2. Re: Better Alpha channel handling
            harry teasley Community Member

            Yeah, I know about that behavior of layers during a resize - it's an important point you raise - but I would have guessed (if I had been asked to) that the alpha channel would behave like the background layer does during a resize. If you resize a white image (background layer only), you don't get sampling against off-canvas info, or at least not, say, arbitrarily black off-canvas info. Shrink a white 1024x1024 white canvas down to 64x64, and the edge pixels of the background layer remain perfectly white, even if your specified background color is not white.

             

            I would expect the same from the alpha.

             

            As to workarounds, yes, this can be worked around, but not very productively. It's labor-intensive and annoying.

            • 3. Re: Better Alpha channel handling
              Noel Carboni Community Member

              Oh, I agree with you, it would be nice...

               

              My point is that alpha (aka a transparency plane under the covers) can only be associated with a layer (not the background) and layers behave differently than the background during resizing - that's a known thing.

               

              I would love to see an option for how to handle layer edges (e.g., a checkbox to allow one to handle resizing the way it is now or the way the background is handled), but alas layer behavior in general cuts all across Photoshop.  It might not be feasible to change behavior that has been at the basis and core of development for many generations of Photoshop.

               

              -Noel

              • 4. Re: Better Alpha channel handling
                harry teasley Community Member

                Noel Carboni wrote:

                 

                My point is that alpha (aka a transparency plane under the covers) can only be associated with a layer (not the background) and layers behave differently than the background during resizing - that's a known thing.

                I believe that to be incorrect: alpha channels are not associated with layers. They are channels.