If you open a png and it has a background layer it means that the png file has no transparence for a Photoshop Background layer does not support transparency. If you want your file to have a background layer why did you convert the background layer to a normal layer to layer 0 which can contain transparency. A background layer is always at least partially locked because is does not support transparency so its transparency is locked its fully opaque. You can edit a background layer paint on it, sharpen in, blur it etc you just can not add transparency to it. You converted the background layer to a normal layer. Why. Its your behavior that need to be corrected. Or save it as a Jpeg file not a png for jpeg does not support transparency like png does. However PNG supports 16bit color and jpeg only support 8bit color. You can also convert the bottom layer in a layered document your editing to a background layer if its not a background layer.
Try doing the following :
1) open a JPG file (no transparency, right?). Background layer is there.
2) save it as PNG
3) open the PNG .. Background layer still there.
4) double-click the bg layer, convert it to Layer 0, save as PNG... still no transparency, right?
5) open the PNG .. Layer 0 ! no more Background Layer.. and still no transparency.
Two things, either Photoshop save that info in the file, or in a cache. And that can be annoying. It's not about my behavior as I depend on files I'm provided and working with, and scripts I made. I can't have 2000 files with Layer 0 and 1200 files with Background layer just because Photoshop is acting weird. Ok I could make a script as a work around to open all files and convert all background layers to layer 0 but I find it's not the way it should be. And I'd rather understand why Photoshop does this and if there's a way to prevent it doing it. And my little example showed you it's not about transparency.
1 person found this helpful
That is correct you converted the background layer to a normal layer in step 4 you no longer have a Photoshop Background you have a normal layer with the contents that was in the background layer without transparency. A normal layer may have transparency it does not have to have transparency. A normal layer can also be larger then the canvas size you can transform it larger then canvas to increase the size of objects over the canvas, You can also convert Layer 0 to a background layer if its the bottom layer. Any transparent empty areas will be filled with pixels, any areas with transparency will be made opaque and any pixels out side the canvas area will be cropped off. Photoshop is not acting weird it is working as designed. You saved a PNG document that did not have a background layer so Photoshop save the PNG file with a normal layer which may or may not contain transparency and transparent areas. PNG format supports transparency and transparent area as does PSD and PSB file formats. Photoshop is working correctly is just not working the way you would like it to. If you want a background layer make one or do not convert the background layer to a normal layer. Your jpg file still has a background layer for the is the only kind of layer supported by jpeg file format is a single background layer.
Scripts can handle documents with and without background layers they can use logic. If you want a background layer always add this to your scripts before they save files.
// Make sure bottom layer is a background layer
var layers = activeDocument.layers;
activeDocument.activeLayer = layers[layers.length-1]; // Target Bottom Layer
activeDocument.activeLayer.isBackgroundLayer=1; // Make it a background Layer
If your manually editing if the bottom layer is not a background layer target it and use menu layer>New Background Layer from layer.
If you just using actions and you converted the background layer before your save as png insert these two steps Alt|OPT+, (shortcut for target bottom layer) second step
menu Layer>New> Background From Layer
The PNG will have no transparency or transparent areas.
Thanks for the script tip and detailed explanation, I'm still clueless finding where Photoshop stores this layer info since there's no layers in a PNG afaik. I supposed it could create an alpha channel (even if nothing is transparent) but there's none when I check the channels tab. I'd need to compare both files with & without photoshop's layer modification.
PNG is not an Adobe format consult the PNG format standard and all PNG file are not the same. There is also a Super PNG plug-in (SuperPNG.8bi) you can install in Photoshop and save PNG file with some more capabilities. I would think that most PGN files would not had a background layer for the main reason users save PNG file is because it has better color capabilities then GIF the other Web Image file format the supports transparent pixels. Gif then will only have up to 255 mapped colors for the 256 color is transparent.