Skip to content

HOW to import an image AS smartobjectLayer #10

Description

@taiamakimo

Hi, I try to import an image to PSD, it's successful, but
is a normal Layer, how to be a smartobjectLayer.
Thank you all for your guidance.
code following:
using (var image = (PsdImage)Aspose.PSD.Image.Load(@"C:\001.psd"))
{

            string filePath = @"C:\test.jpg";
            using (var stream = new FileStream(filePath, FileMode.Open))
            {
                Layer layer = null;
                try
                {
                    layer = new Layer(stream);
                    image.AddLayer(layer); 
                }
                catch (Exception e2)
                {
                    if (layer != null)
                    {
                        layer.Dispose();
                    }
                    throw e2;
                }
            }

            image.Save(@"C:\003.psd");
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions