Free Support Forum - aspose.com

[Critical Bug] Since last update, save to PNG fail

I have a PSD trying to save PNG but it write incorrect PNG file.
On the other hand, saving to JPG and PSD is fine. Seems only PNG is broken.
Please fix it ASAP.

input2.zip (51.7 KB)

Sample Code:

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 +"/input2.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 +" /output2.psd");
            image.Save(dataDir +" /output2.png", new PsdOptions());
            image.Save(dataDir +" /output2.jpg", new JpegOptions());
        }
    }

@fantasyz,

I have worked with the sample file shared and have created an issue with ID PSDNET-590 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.

@fantasyz,

We have observed that you have been using wrong code while saving. You were using newPsdOptions() class to save as PNG. You need to use PngOptions() class.

image.Save(dataDir +" /output2.png", new PsdOptions());

The correct code is:

image.Save(dataDir +" /output2.png", new PngOptions());