This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Not able to convert PSD to PNG file

Hi,

I tried to convert PSD file to PNG directly it works fine, but i try to iterate through frame and convert to png image is not proper is merged. some of the pattern in PSD file is missing after PNG conversion

Working code:
using (var psdReader = new PsdReader(@"C:\temp\photooverlay_5.psd"))
                var bitmap = psdReader.MergedImageFrame.GetBitmap();
                bitmap.Save(@"C:\temp\photooverlay_01.png");
attach #1331


Non-working code:
**********************
using (var psdReader = new PsdReader(@"C:\temp\photooverlay_5.psd"))
using (var bitmap = new Bitmap(psdReader.Width, psdReader.Height, psdReader.PixelFormat)
                {
                    DpiX = psdReader.DpiX,
                    DpiY = psdReader.DpiY
                })
                {

                    //read layers and save raster layers in PNG files
                    for (int i = 0; i < psdReader.Frames.Count; i++)
                    {
                        using (var frame = psdReader.Frames[i])
                        {
                           
                                using (var bitmap1 = frame.GetBitmap())
                                {
                                    bitmap1.Save(@"C:\temp\frame_" + frame.Name + ".png");
                                    var rect = new System.Drawing.Rectangle()
                                    {
                                        X = frame.X,
                                        Y = frame.Y,
                                        Width = frame.Width,
                                        Height = frame.Height
                                    };

                                    bitmap.Draw(bitmap1, rect, Aurigma.GraphicsMill.Transforms.CombineMode.Alpha, 1.0f,
                                        Aurigma.GraphicsMill.Transforms.ResizeInterpolationMode.High);
                                }
                           
                        }
                    }
                    bitmap.Save(@"C:\temp\photooverlay_03.png");
                }
Could you post a sample PSD file? It should help to understand the problem better.
I have attached *.psd file. Please check the post
Graphics Mill supports a limited subset of PSD blending options. For example, we don't support the Pattern Overlay style.

That's why we recommend to rasterize a layer style to get a correct result.

attach #1333