12 Replies Latest reply on Dec 10, 2013 1:05 AM by Broken Pictures

    How do i stop PS from deleting transparent Pixels on layers?

    Broken Pictures

      Hello community,

       

      i have a problem concering the place-function of Photoshop CS6. I want to include hundreds of png files in a psd file and i want them to keep their original size. Unfortinatly they have transparent borders and PS deletes these borders when you place the images in the PSD-file. For example: I have a square with x=50px and y=50px and it is positioned in an png with the dimensions x=100px and y=100px. I want to have these kind of files in my psd-file an need to keep their full dimensions, because my graphic specifications relate to the 100px/100px size and i need it later in my workflow.

       

      How do i stop PS from cutting off the tranparent borders of my images?

       

      100x100px_image_placement.PNGresized image.PNG

        • 1. Re: How do i stop PS from deleting transparent Pixels on layers?
          Chuck Uebele Adobe Community Professional & MVP

          I'm not sure that's possible, although that would be a nice option.  Only two ways I can see around this:

           

          1. change the png file type to PSB and put a non visible layer in the SO to that PS thinks there are pixels all the way to the borders.

           

          2. put a very tiny dot in two opposting corners of the file at the 1% opacity, so that you can't see it, but PS detects it and does not crop.

           

          With hundreds of files, as you mentioned, neither of these options are ideal.  Both could be scripted so that you don't have to manually do it. 

          • 2. Re: How do i stop PS from deleting transparent Pixels on layers?
            Chuck Uebele Adobe Community Professional & MVP

            Just checked CS6, and it doesn't delete the pixels.  What version of PS are you using? 

             

            Edit, just saw that you're using CS6.  don't know why you files are being trimmed.

            • 3. Re: How do i stop PS from deleting transparent Pixels on layers?
              JJMack Most Valuable Participant

              His files are not being trimmed and the smart object embedded object can be opened in Photoshop the by opening the smart layers embedded object he will see his missing transparent area with the non transparent pixels in the correct location. However the pixel rendered for the smart object layer are not tied the the embedded object bounds they are positioned over the documents canvas  how the were placed in.  Smart Object layer act like pixel layers.  If you delete pixels from the borders of a layer the layer bounds will shrink. Here I place in the same png file twice. One I rotated and moved.  The layer bound are 70 wide 72 high the one not rotated bound are 50 wide and high.  Open either object they are 100 by 100 with a 50 by 50 center area with gray pixels. Pasting in will act the same and the pixel pasted in cane even shift.  Make section do a copy followed by two paste the two new layers may not line up with the selection if the selection layer had transparent pixels in the border areas. If no transparent pixel were selected the first paste may line up but I find the second past is often shifted

              Capture.jpg

              • 4. Re: How do i stop PS from deleting transparent Pixels on layers?
                Piewsook

                I found that the transparent pixels will be trimmed if you drag the layer from the PNG file directly into your target file.

                 

                However if you use the Place (File/Place) command to import your PNG as smart object, the transparent part of the PNG still registers, e.g. when you use Free Transform to scale the layer. If you rasterize this layer, the transparent part will be removed.

                • 5. Re: How do i stop PS from deleting transparent Pixels on layers?
                  Chuck Uebele Adobe Community Professional & MVP

                  John, you image didn't come through.  All I see is capture.jpg.

                   

                  Fong, yes, if you create a SO of a file that has transparency that is open, it will trim the transparent pixels.  However, if you place the SO with the main menu, Bridge, or Mini Bridge, the transparency will be retained.  What I find odd about the OP's screen captures is that the first image, I assume is the png being placed.  The second image is of it being resized.  However, there is only one layer in the layers' panel, and it's not a SO.  You can also tell that the transform box doesn't have the cross lines.  It looks like the placed SO was rasterized or merged with a blank layer.

                  • 6. Re: How do i stop PS from deleting transparent Pixels on layers?
                    JJMack Most Valuable Participant

                    Yes Free Transform has what was set during the place and you can see in the option bar if the layer has been scaled or is at 100 % width and height. You can also drag out guide line to the transforms bounding box. Then later measure the size or drop in a low opacity pixel in two diagonal corners to force the bounds to the png's canvas size.   However if you don't add those pixels in a script the bounds you get is that of the bounds of the non transparent pixels and in an action Ctrl|CMD clicking the layers content in the layers palette selects the non transparent pixels.

                     

                    My Photoshop Photo Collage populating scripts do not always fill an image area when they resizing odd shaped png images, However if the png is rectangular with transparent borders the script will fill the area with pixel for the scripts gets the bounds of the non transparent pixels, not the png canvas size. So resizing works well. There is a difference between layer size and canvas size in the png file. Layers can also be larger then canvas size in psd files Photoshop support any size layer you have the canvas act like a cropping mask on a document.

                    Capture.jpg

                    Capture1.jpg

                     

                    Message was edited by: JJMack

                    • 7. Re: How do i stop PS from deleting transparent Pixels on layers?
                      JJMack Most Valuable Participant

                      What is happing is logical and works the way Photoshop was designed to work.  Still it confuses us humans because we use more then logic when we lack complete knowledge we postulate, guess, use what we believe is true, guess and sometime even get it right. Here i create a new 100px by 100px 300dpi document and set guide line 50% vertical and horizontal. I then stroked the four edges of the empty layer 0 three times and moved them to form a  plus sign 100px wide and high 2pn in thickness.  I save this as a PNG and as a PSD.  I then open two new 400x400px 300 dpi white documents and placed in the png in one and the psd in the other the  opened the embedded object you can see the PSD retained all where the PNG only has a single layer and lost the guide lines. Both placed smart object layers look the sane and act the same but the embedded objects are quite different.

                      Capture.jpg

                      Placing.jpg

                      • 8. Re: How do i stop PS from deleting transparent Pixels on layers?
                        Broken Pictures Level 1

                        Thank you very much for your explainations and help!

                         

                        I guess i will try to solve the problem by painting the 1px/1px coordinate and the lower-left pixel of each png-file with 1% opacity using a batch. Do you have any suggestions on how this could be achieved? The images are of different size. That´s why i can´t relate to fixed pixels, but have to adress relative points within each png-file.

                        • 9. Re: How do i stop PS from deleting transparent Pixels on layers?
                          Chuck Uebele Adobe Community Professional & MVP

                          After playing with this a bit, it looks like you shouldn't have this trouble.  How are you creating the Smart Object that you showed in your original post?  Like I mentioned previously, It looks like your transformation of the layer isn't a smart object anymore, so it looks like the layer has been merged.

                          • 10. Re: How do i stop PS from deleting transparent Pixels on layers?
                            JJMack Most Valuable Participant

                            To Force the layer bounds to be the same as the png canvas size you would need to make sure that there is at least on pixel in each canvas side edge.  That can be done with two pixels in diagonal corners. The trouble with painting in a pixel there is there may be a pixel there that you would be changing. So I think the safest was to do it would be using an action you batch with the Image Processor Pro to save new PNG files in some folder. Since you dealing with png files that are not layered and do not have a background because a Photoshop background does not support transparency.  So you can create an action the would add a new empty layer and move the layer to the bottom of the layer stack.  The action could the select a 1px by 1px selection in the top left corner and fill with black then select a 1px by 1px selection in the bottom right corner and fill with black. Then set the layer opacity to 1%. Its easy to record those selections you set the rectangle marquee tool to fixed size 1px by 1px set ruler units to percent then be able to click above and left of the top left corner and be able to click below and right of the bottom right order. Record this action.

                            Capture.jpg

                            • 11. Re: How do i stop PS from deleting transparent Pixels on layers?
                              JJMack Most Valuable Participant

                              A smart object layer act like a raster layer. Photoshop supports any size normal layer the only layer that is always canvas size is a background layer for they do not support transparency. Normal layers can be any size and do not even need to have pixels over the document canvas.  If a png file is created with a canvas size 100px by 100px and the contents of the png layer is only a small area in the middle  the layer is smaller then canvas size.  This is what the OP is seeing.  If you do a Free transform on the Smart Object you will see the smart objects canvas size framed by the transform frame like you see during the place. If you do a select all or use a script on the layer to get its pixels or its bounds. You will get the layer which is smaller then the png's canvas size.

                              • 12. Re: How do i stop PS from deleting transparent Pixels on layers?
                                Broken Pictures Level 1

                                JJMack schrieb:

                                 

                                Its easy to record those selections you set the rectangle marquee tool to fixed size 1px by 1px set ruler units to percent

                                 

                                Thank you very much! That was the missing piece of the puzzle for the macro! This will save me a significant amount of time, perhaps 3-7 days of work.