Free Support Forum - aspose.com

Update layer name

I’m using Aspose.Imaging.18.3.0
The layer name and layer text are two independent properties in Photoshop. How can I change the layer name without invoking “UpdateText” method? Currently UpdateText changes the text value and the name of the layer. I want to change the name of Image layer which doesn’t have text. The property Layer.Name doesn’t have setter.

@tividan,

I have observed your comments. I like to inform that as per API reference there is setter for Name. Can you please visit this link for more detail. Also please share source file so that we may further investigate to help you out.

Thank you, but how can update DisplayName? without UpdateText method

@tividan,

I have observed your comments. I have shared sample code with you. This will help you to achieve your requirements. Please share feedback with us if there is still an issue.

string sourceFileName = “Cloud_AzPlat_Banner3A_SB_EN_US_160x600.psd”;

        using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(sourceFileName))
        {
            var psdImage = (Aspose.Imaging.FileFormats.Psd.PsdImage) image;
            
            Console.WriteLine("Number of layers :" + psdImage.Layers.Length);
            for (int i=0;i<psdImage.Layers.Length;i++)
            {
                Console.WriteLine("Layer name :" + psdImage.Layers[i].Name);
                psdImage.Layers[i].Name += "*";
            }
            image.Save();
        }