How to delete a layer in psd file?I didn’t find it in the method provided by psd. Is it not supported?
Can you please provide more details about the method you are using to delete a layer in the PSD file?
@zyyxiage please try using LINQ. It’s most comfy way for layers set editing for .NET:
using (var psdImage = (PsdImage)Image.Load(srcFile))
{
var layers = new List<Layer>(psdImage.Layers);
layers.RemoveAll(it => it.DisplayName == "B");
psdImage.Layers = layers.ToArray();
}
Hello, I would like to ask how to delete in java?
@houdajin you can modify the array of layers in the comfy way for you, for example using:
Layer[] layers = psdImage.getLayers();
layers = ArrayUtils.remove(layers, element);
psdImage.setLayers(layers);