Free Support Forum - aspose.com

Incorrect output after changing visibility of a LayerGroup (critical)

Layers inside LayerGroup is ignoring the visibility of the parent LayerGroup.
e.g. Layers is still visible even when container group is invisible.
Result can be observed from output image or the returned image from ToBitmap().

From sample code below. Notice that the apple is still visible even the group holding the apple layers are invisible.

Sample PSD:
input.zip (62.9 KB)

Sample Code:

class TurnOffGroupTest
{

    public static void Run()
    {
        // The path to the documents directory.
        string dataDir = RunExamples.GetDataDir_PSD();
        
        // make changes in layer names and save it
        using (var image = (PsdImage)Image.Load(dataDir +"/input.psd"))
        {
            for (int i = 0; i < image.Layers.Length; i++)
            {
                var layer = image.Layers[i];

                // Turn off everything inside a group
                if (layer is FileFormats.Psd.Layers.LayerGroup)
                {
                    layer.IsVisible = false;
                }
            }

            image.Save(dataDir +" /output.psd");
        }

        //ExEnd:ExtractLayerName
    }
}

P.S. just plug the code and sample PSD to your provided sample project to test.

@fantasyz,

I have observed the issue shared by you and have created an issue with ID PSDNET-541 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.