Class PsdOptions

Class PsdOptions

Namespace: Aspose.Imaging.ImageOptions
Assembly: Aspose.Imaging.dll (25.7.0)

Create Photoshop Document (PSD) images with our API, offering versatile optionswith different format versions, compression methods, color modes, andbits counts per color channel. Seamlessly handle XMP metadata containers,ensuring comprehensive image processing with the power of PSD format featureslike image layers, layer masks, and file information for customizationand creativity in your designs.

[JsonObject(MemberSerialization.OptIn)]
public class PsdOptions : ImageOptionsBase, IDisposable, IHasXmpData, IHasMetadata, ICloneable
{
}

Inheritance

object DisposableObject ImageOptionsBase PsdOptions

Implements

IDisposable , IHasXmpData , IHasMetadata , ICloneable

Inherited Members

ImageOptionsBase.Clone() , ImageOptionsBase.ReleaseManagedResources() , ImageOptionsBase.KeepMetadata , ImageOptionsBase.XmpData , ImageOptionsBase.Source , ImageOptionsBase.Palette , ImageOptionsBase.ResolutionSettings , ImageOptionsBase.VectorRasterizationOptions , ImageOptionsBase.BufferSizeHint , ImageOptionsBase.MultiPageOptions , ImageOptionsBase.FullFrame , ImageOptionsBase.ProgressEventHandler , DisposableObject.Dispose() , DisposableObject.ReleaseManagedResources() , DisposableObject.ReleaseUnmanagedResources() , DisposableObject.VerifyNotDisposed() , DisposableObject.Disposed , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

This example demonstrates the use of Aspsoe.Imaging for .Net API to convert Images to PSD format. To achieve this goal this example loads an existing image and then saves it back to PSD format.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       Aspose.Imaging.ImageOptions.PsdOptions psdOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
       psdOptions.CompressionMethod = Aspose.Imaging.FileFormats.Psd.CompressionMethod.RLE;
       psdOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Grayscale;
       image.Save(dir + "output.psd", psdOptions);
   }

The following example shows how to convert a multipage vector image to PSD format in general way without referencing to a particular image type.

string dir = "C:\\aspose.imaging\\net\\misc\\ImagingReleaseQATester\\Tests\\testdata\\2548";
   string inputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr");
   string outputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr.psd");
   Aspose.Imaging.ImageOptionsBase exportOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFilePath))
   {
       exportOptions.MultiPageOptions = null;
       Aspose.Imaging.IMultipageImage multipageImage = image as Aspose.Imaging.IMultipageImage;
       if (multipageImage != null && multipageImage.Pages != null && multipageImage.PageCount > 2)
       {
           exportOptions.MultiPageOptions = new Aspose.Imaging.ImageOptions.MultiPageOptions(new Aspose.Imaging.IntRange(0, 2));
       }
       if (image is Aspose.Imaging.VectorImage)
       {
           exportOptions.VectorRasterizationOptions = (Aspose.Imaging.ImageOptions.VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Aspose.Imaging.Color.White, image.Width, image.Height });
           exportOptions.VectorRasterizationOptions.TextRenderingHint = Aspose.Imaging.TextRenderingHint.SingleBitPerPixel;
           exportOptions.VectorRasterizationOptions.SmoothingMode = Aspose.Imaging.SmoothingMode.None;
       }
       image.Save(outputFilePath, exportOptions);
   }

Constructors

PsdOptions()

Initializes a new instance of the Aspose.Imaging.ImageOptions.PsdOptions class.

public class PsdOptions
   {
      [JsonConstructor]
      public PsdOptions()
      {
      }
   }

PsdOptions(PsdOptions)

Initializes a new instance of the Aspose.Imaging.ImageOptions.PsdOptions class.

public PsdOptions(PsdOptions options)
{
    this.Compression = options.Compression;
    this.Crc = options.Crc;
    this.ColorMode = options.ColorMode;
    this.BackgroundColor = options.BackgroundColor;
    this.Interlacing = options.Interlacing;
    this.AlphaChannelsAreSpotted = options.AlphaChannelsAreSpotted;
}

Parameters

options PsdOptions

The options.

Properties

ChannelBitsCount

Gets or sets the bits count per color channel.

public short ChannelBitsCount
    {
        get;
        set;
    }

Property Value

short

Examples

This example shows how to save a PNG image to PSD format using various PSD-specific options.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100, Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha))
   {
       Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
           new Aspose.Imaging.Point(0, 0),
           new Aspose.Imaging.Point(pngImage.Width, pngImage.Height),
           Aspose.Imaging.Color.Blue,
           Aspose.Imaging.Color.Transparent);
       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(pngImage);
       graphics.FillRectangle(gradientBrush, pngImage.Bounds);
       Aspose.Imaging.ImageOptions.PsdOptions saveOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
       saveOptions.ChannelBitsCount = 8;
       saveOptions.ChannelsCount = 4;
       saveOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Rgb;
       saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.Raw;
       saveOptions.Version = 6;
       using (System.IO.FileStream stream = System.IO.File.Create(dir + "saveoptions.psd"))
       {
           pngImage.Save(stream, saveOptions);
           Console.WriteLine("The size of the PSD image with RAW compression: {0}", stream.Length);
       }
       using (System.IO.FileStream stream = System.IO.File.Create(dir + "saveoptions.RLE.psd"))
       {
           saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.RLE;
           pngImage.Save(stream, saveOptions);
           Console.WriteLine("The size of the PSD image with RLE compression: {0}", stream.Length);
       }
   }

ChannelsCount

Gets or sets the color channels count.

public short ChannelsCount
    {
        get;
        set;
    }

Property Value

short

Examples

This example shows how to save a PNG image to PSD format using various PSD-specific options.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100, Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha))
   {
       Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
               new Aspose.Imaging.Point(0, 0),
               new Aspose.Imaging.Point(pngImage.Width, pngImage.Height),
               Aspose.Imaging.Color.Blue,
               Aspose.Imaging.Color.Transparent);
       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(pngImage);
       graphics.FillRectangle(gradientBrush, pngImage.Bounds);
       Aspose.Imaging.ImageOptions.PsdOptions saveOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
       saveOptions.ChannelBitsCount = 8;
       saveOptions.ChannelsCount = 4;
       saveOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Rgb;
       saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.Raw;
       saveOptions.Version = 6;
       using (System.IO.FileStream stream = System.IO.File.Create(dir + "saveoptions.psd"))
       {
           pngImage.Save(stream, saveOptions);
           System.Console.WriteLine("The size of the PSD image with RAW compression: {0}", stream.Length);
       }
       using (System.IO.FileStream stream = System.IO.File.Create(dir + "saveoptions.RLE.psd"))
       {
           saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.RLE;
           pngImage.Save(stream, saveOptions);
           System.Console.WriteLine("The size of the PSD image with RLE compression: {0}", stream.Length);
       }
   }

ColorMode

Gets or sets the psd color mode.

public ColorModes ColorMode
    {
        get;
        set;
    }

Property Value

ColorModes

Examples

This example demonstrates the use of Aspsoe.Imaging for .Net API to convert Images to PSD format. To achieve this goal this example loads an existing image and then saves it back to PSD format.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       Aspose.Imaging.ImageOptions.PsdOptions psdOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
       psdOptions.CompressionMethod = Aspose.Imaging.FileFormats.Psd.CompressionMethod.RLE;
       psdOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Grayscale;
       image.Save(dir + "output.psd", psdOptions);
   }

This example shows how to save a PNG image to PSD format using various PSD-specific options.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100, Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha))
   {
       Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
           new Aspose.Imaging.Point(0, 0),
           new Aspose.Imaging.Point(pngImage.Width, pngImage.Height),
           Aspose.Imaging.Color.Blue,
           Aspose.Imaging.Color.Transparent);
       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(pngImage);
       graphics.FillRectangle(gradientBrush, pngImage.Bounds);
       Aspose.Imaging.ImageOptions.PsdOptions saveOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
       saveOptions.ChannelBitsCount = 8;
       saveOptions.ChannelsCount = 4;
       saveOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Rgb;
       saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.Raw;
       saveOptions.Version = 6;
       using (System.IO.FileStream stream = System.IO.File.Create(dir + "saveoptions.psd"))
       {
           pngImage.Save(stream, saveOptions);
           Console.WriteLine("The size of the PSD image with RAW compression: {0}", stream.Length);
       }
       using (System.IO.FileStream stream = System.IO.File.Create(dir + "saveoptions.RLE.psd"))
       {
           saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.RLE;
           pngImage.Save(stream, saveOptions);
           Console.WriteLine("The size of the PSD image with RLE compression: {0}", stream.Length);
       }
   }

CompressionMethod

Gets or sets the psd compression method.

public CompressionMethod CompressionMethod
    {
        get;
        set;
    }

Property Value

CompressionMethod

Examples

This example demonstrates the use of Aspsoe.Imaging for .Net API to convert Images to PSD format. To achieve this goal this example loads an existing image and then saves it back to PSD format.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       var psdOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
       psdOptions.CompressionMethod = Aspose.Imaging.FileFormats.Psd.CompressionMethod.RLE;
       psdOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Grayscale;
       image.Save(dir + "output.psd", psdOptions);
   }

This example shows how to save a PNG image to PSD format using various PSD-specific options.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100, Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha))
   {
       Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
               new Aspose.Imaging.Point(0, 0),
               new Aspose.Imaging.Point(pngImage.Width, pngImage.Height),
               Aspose.Imaging.Color.Blue,
               Aspose.Imaging.Color.Transparent);
       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(pngImage);
       graphics.FillRectangle(gradientBrush, pngImage.Bounds);
       Aspose.Imaging.ImageOptions.PsdOptions saveOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
       saveOptions.ChannelBitsCount = 8;
       saveOptions.ChannelsCount = 4;
       saveOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Rgb;
       saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.Raw;
       saveOptions.Version = 6;
       using (System.IO.FileStream stream = System.IO.File.Create(dir + "saveoptions.psd"))
       {
           pngImage.Save(stream, saveOptions);
           Console.WriteLine("The size of the PSD image with RAW compression: {0}", stream.Length);
       }
       using (System.IO.FileStream stream = System.IO.File.Create(dir + "saveoptions.RLE.psd"))
       {
           saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.RLE;
           pngImage.Save(stream, saveOptions);
           Console.WriteLine("The size of the PSD image with RLE compression: {0}", stream.Length);
       }
   }

PsdVersion

Gets or sets the file format version. It can be PSD or PSB.

public PsdVersion PsdVersion
   {
      get;
      set;
   }

Property Value

PsdVersion

RefreshImagePreviewData

Gets or sets a value indicating whether [refresh image preview data] - option used to maximize compatibility with another PSD image viewers.Please note, text layers drawing to final layout is not supported for Compact Framework platform

public bool RefreshImagePreviewData
   {
      get;
      set;
   }

Property Value

bool

RemoveGlobalTextEngineResource

Gets or sets a value indicating whether - Remove the global text engine resource - Used for some text-layered psd files, in only case, when they can not be opened in Adobe Photoshop after processing (mostly for absent fonts text layers related).After using this option, user need to Make next in opened in Photoshop file: Menu “Text” -> “Process absent fonts”. After that operation all text will appear again.Please note, that this operation may cause some final layout changes.

public bool RemoveGlobalTextEngineResource
{
    get;
    set;
}

Property Value

bool

VectorizationOptions

Gets or sets the PSD vectorization options.

public PsdVectorizationOptions PsdVectorizationOptions
    {
        get;
        set;
    }

Property Value

PsdVectorizationOptions

Version

Gets or sets the psd file version.

public int Version
    {
        get;
        set;
    }

Property Value

int

Examples

This example shows how to save a PNG image to PSD format using various PSD-specific options.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100, Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha))
   {
       Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
           new Aspose.Imaging.Point(0, 0),
           new Aspose.Imaging.Point(pngImage.Width, pngImage.Height),
           Aspose.Imaging.Color.Blue,
           Aspose.Imaging.Color.Transparent);
       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(pngImage);
       graphics.FillRectangle(gradientBrush, pngImage.Bounds);
       Aspose.Imaging.ImageOptions.PsdOptions saveOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
       saveOptions.ChannelBitsCount = 8;
       saveOptions.ChannelsCount = 4;
       saveOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Rgb;
       saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.Raw;
       saveOptions.Version = 6;
       using (System.IO.FileStream stream = System.IO.File.Create(dir + "saveoptions.psd"))
       {
           pngImage.Save(stream, saveOptions);
           Console.WriteLine("The size of the PSD image with RAW compression: {0}", stream.Length);
       }
       using (System.IO.FileStream stream = System.IO.File.Create(dir + "saveoptions.RLE.psd"))
       {
           saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.RLE;
           pngImage.Save(stream, saveOptions);
           Console.WriteLine("The size of the PSD image with RLE compression: {0}", stream.Length);
       }
   }

XmpData

Get or set XMP data container

public override XmpPacketWrapper XmpData
    {
        get;
        set;
    }

Property Value

XmpPacketWrapper

 English