6 Replies Latest reply on Sep 16, 2012 7:34 PM by shanahan3030

    Issue with layer masked PNG

    shanahan3030

      I'm wondering how PhotoShop modifies a file that's had a layer mask applied to it, because I'm having a peculiar problem with layer masked images. I ran the following test because I needed to mask an image my sister sent me, & the image was getting messed up when it was scaled on her website:

       

      I created 2 PNGs.

       

      (1) With one, I created at a black & white image & then replace the white with transparency by applying a layer mask.

      (2) For the other, I started with a transparent background & added black. No layer mask.

       

      When I open the image which had a layer mask applied (1) in one of the other programs on my computer, the mask is inverted! All the white from the original image shows, & the black is now transparent. That makes me think the layer mask is stored somehow in the PNG file. And it has a different problem when her websote scales it - it turns solid gray.

       

      I don't have any problems whatsoever with the image that wasn't created with a mask (2).

       

      Unfortunately, with the image my sister sent me, I don't have the option to start over with a transparent BG, & don't want to cut out the background because I'm trying not to lose the partialy transparent pixels, or leave pixels that have the orginal background partially showing through.

       

      What can I do so that the PNG file created by applying a mask stores what I see, and doesn't need to store the layer mask?

       

      I'm using Adobe CS5, version 12.02, on Mac OS X 10.6.

        • 1. Re: Issue with layer masked PNG
          Joprysko Level 3

          Quick solution, save it as a TGA and preserve the transparency, or choose 32 bit TGA, what ever option you get in the other app.  Then photoshop will open it properly.

           

           

          Actuallty scratch what I said, I am backwards in my thinking.

           

           

          What app is she using? Gimp by chance or some other app. Does it have the ability to save the image as a photshop file format .PSD?  If so you may want to do that.

           

          Masks are sometimes not saved properly on PNG's since they cant handle layers.

           

          A potential solutions.

           

          With the mask applied do a copy and paste into a new image. In the new image you will have it no longer masked but only the visible portion of the original image is saved, then save that as a PNG.

          • 2. Re: Issue with layer masked PNG
            Level 7

            PNG files can't store layer masks, just simple transparency.

            But it sounds like one of your programs does not read PNG transparency correctly.

            And some web browsers (esp. older versions of IE) can't render PNG transparency.

            • 3. Re: Issue with layer masked PNG
              shanahan3030 Level 1

              HI Jopryshko,

               

              Thanks for your suggestion. I just found the problem!

               

              The original image I received from my sister was a gray scale image, & when I ran my test, I guess I must have converted the one where I didn't use a layer mask to be an RGB image, or I must have converted the one with the layer mask to a gray scale image! Either way, both images that had masks were also both gray scale images! I just verified this by making the grayscale one RGB, & converting the RGB one, without the layermask, grayscale. It's grayscale that's causing the problem.

               

              Once I converted my sisters image to RGB, everything worked fine. So I guess it's some issue with grayscale PNGs?

              • 4. Re: Issue with layer masked PNG
                shanahan3030 Level 1

                Hi Chris, thanks for the reply. It turns out there was another difference between the image that I didn't realize. The one that didn't display correctly was grayscale, & the one that did display correctly was RGB.

                 

                What I saw happening, incase you're curious, was I uploaded the grayscale image to my sister's WordPress website, using the WordPress GUI, which creates scaled copies of the uploaded images. For one of the scaled images, the entire picture became gray, & for the other picture, all the transparency became gray. But in all cases, the original always looked fine. When I save the files in RGB mode, I have no problems whatsoever.

                • 5. Re: Issue with layer masked PNG
                  Joprysko Level 3

                  No issue with grayscale transparency, Transparency cant be saved on a grayscale image, there is only black and white and shades of gray.

                  • 6. Re: Issue with layer masked PNG
                    shanahan3030 Level 1

                    Are you sure about no transparency with grayscale? One of the images I'm talking about can be viewed here:

                     

                    http://danshanahansart.com/images/grayscalePNGwithtransparency.png

                     

                    When I open this image in PhotoShop (or Gimp), & look at the Mode, Grayscale is checked. And in most programs I view it in on the Mac (including PhotoShop of course, Gimp, Firefox, Safari, and Preview) it displays with transparent pixels & when I view the image with IE on Windows 7, it displays correclty there too. There are only a few instances where the grayscale image doesn't display the way I was expecting. One of them is with the program "Graphic Converter", a Mac only program. And when it was giving me a problem on WordPress, it was only after WordPress automatically scaled it. The original grayscale PNG with transparency displayed fine in WordPress. Anyway, it's obviously not a problem with PhotoShop. It's something about how those other 2 programs deal with grayscale PNGs with transparency.