Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
saravanakumar38  
#1 Posted : Wednesday, May 10, 2017 6:52:15 AM(UTC)
saravanakumar38

Rank: Newbie

Groups: Member
Joined: 5/10/2017(UTC)
Posts: 4

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:
Code:
using (var psdReader = new PsdReader(@"C:\temp\photooverlay_5.psd"))
                var bitmap = psdReader.MergedImageFrame.GetBitmap();
                bitmap.Save(@"C:\temp\photooverlay_01.png");
photooverlay_5.zip (2,143kb) downloaded 4 time(s).


Non-working code:
**********************
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");
                }

Edited by user Wednesday, May 10, 2017 9:24:05 AM(UTC)  | Reason: code formatting

Fedor  
#2 Posted : Wednesday, May 10, 2017 9:09:11 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,558

Thanks: 5 times
Was thanked: 62 time(s) in 61 post(s)
Could you post a sample PSD file? It should help to understand the problem better.
Best regards,
Fedor Skvortsov
saravanakumar38  
#3 Posted : Wednesday, May 10, 2017 9:25:36 AM(UTC)
saravanakumar38

Rank: Newbie

Groups: Member
Joined: 5/10/2017(UTC)
Posts: 4

I have attached *.psd file. Please check the post
Fedor  
#4 Posted : Wednesday, May 10, 2017 9:47:02 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,558

Thanks: 5 times
Was thanked: 62 time(s) in 61 post(s)
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.

rasterize-layer-style.png



Best regards,
Fedor Skvortsov
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.