Class PsdOptions
Nome do espaço: Aspose.Imaging.ImageOptions Assembleia: Aspose.Imaging.dll (25.4.0)
Crie imagens do Photoshop Document (PSD) com a nossa API, oferecendo opções versáteiscom diferentes versões de formato, métodos de compressão, modos de cores, ebits contam por canal de cores. manusear sem problemas os contêineres de metadados XMP,Garantir um processamento de imagem abrangente com o poder de recursos de formato PSDcomo camadas de imagem, máscaras de camadas e informações de arquivo para personalizaçãoCriatividade em seus desenhos.
[JsonObject(MemberSerialization.OptIn)]
public class PsdOptions : ImageOptionsBase, IDisposable, IHasXmpData, IHasMetadata, ICloneable
Inheritance
object ← DisposableObject ← ImageOptionsBase ← PsdOptions
Implements
IDisposable , IHasXmpData , IHasMetadata , ICloneable
Membros herdados
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
Este exemplo demonstra o uso de Aspsoe.Imaging para .Net API para converter Imagens em formato PSD. Para atingir este objetivo, este exemplo carrega uma imagem existente e, em seguida, a salva de volta ao formato PSD.
string dir = "c:\\temp\\";
//Creates an instance of image class and initialize it with an existing file through File path
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.bmp"))
{
//Create an instance of PsdOptions class
Aspose.Imaging.ImageOptions.PsdOptions psdOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
//Set the CompressionMethod as RLE
//Note: Other supported CompressionMethod is CompressionMethod.RAW [No Compression]
psdOptions.CompressionMethod = Aspose.Imaging.FileFormats.Psd.CompressionMethod.RLE;
//Set the ColorMode to GrayScale
//Note: Other supported ColorModes are ColorModes.Bitmap and ColorModes.RGB
psdOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Grayscale;
//Save the image to disk location with supplied PsdOptions settings
image.Save(dir + "output.psd", psdOptions);
}
O exemplo a seguir mostra como converter uma imagem de vector multipágina para o formato PSD em geral sem referência a um tipo de imagem específico.
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;
// Export only first two pages. These pages will be presented as layers in the output PSD.
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()
Inicia uma nova instância da classe Aspose.Imaging.ImageOptions.PsdOptions.
[JsonConstructor]
public PsdOptions()
PsdOptions(PsdOptions)
Inicia uma nova instância da classe Aspose.Imaging.ImageOptions.PsdOptions.
public PsdOptions(PsdOptions options)
Parameters
options
PsdOptions
As opções .
Properties
ChannelBitsCount
Obter ou definir os bits contando por canal de cores.
public short ChannelBitsCount { get; set; }
Valor da propriedade
Examples
Este exemplo mostra como salvar uma imagem PNG para o formato PSD usando várias opções específicas do PSD.
string dir = "c:\\temp\\";
// Create a PNG image of 100x100 px.
using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100, Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha))
{
// Define a linear blue-transparent gradient.
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);
// Fill the PNG image with the linear blue-transparent gradient.
graphics.FillRectangle(gradientBrush, pngImage.Bounds);
// The following options will be used to save the PNG image to PSD format.
Aspose.Imaging.ImageOptions.PsdOptions saveOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
// The number of bits per channel
saveOptions.ChannelBitsCount = 8;
// The number of channels. One channel for each color component R,G,B,A
saveOptions.ChannelsCount = 4;
// The color mode
saveOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Rgb;
// No compression
saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.Raw;
// Default version is 6
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"))
{
// The RLE compression allows to reduce the size of the output image
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);
}
// The output may look like this:
// The size of the PSD image with RAW compression: 40090
// The size of the PSD image with RLE compression: 16185
}
ChannelsCount
Receba ou coloca os canais de cores contando.
public short ChannelsCount { get; set; }
Valor da propriedade
Examples
Este exemplo mostra como salvar uma imagem PNG para o formato PSD usando várias opções específicas do PSD.
string dir = "c:\\temp\\";
// Create a PNG image of 100x100 px.
using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100, Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha))
{
// Define a linear blue-transparent gradient.
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);
// Fill the PNG image with the linear blue-transparent gradient.
graphics.FillRectangle(gradientBrush, pngImage.Bounds);
// The following options will be used to save the PNG image to PSD format.
Aspose.Imaging.ImageOptions.PsdOptions saveOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
// The number of bits per channel
saveOptions.ChannelBitsCount = 8;
// The number of channels. One channel for each color component R,G,B,A
saveOptions.ChannelsCount = 4;
// The color mode
saveOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Rgb;
// No compression
saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.Raw;
// Default version is 6
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"))
{
// The RLE compression allows to reduce the size of the output image
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);
}
// The output may look like this:
// The size of the PSD image with RAW compression: 40090
// The size of the PSD image with RLE compression: 16185
}
ColorMode
Obter ou definir o modo de cor PSD.
public ColorModes ColorMode { get; set; }
Valor da propriedade
Examples
Este exemplo demonstra o uso de Aspsoe.Imaging para .Net API para converter Imagens em formato PSD. Para atingir este objetivo, este exemplo carrega uma imagem existente e, em seguida, a salva de volta ao formato PSD.
string dir = "c:\\temp\\";
//Creates an instance of image class and initialize it with an existing file through File path
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.bmp"))
{
//Create an instance of PsdOptions class
Aspose.Imaging.ImageOptions.PsdOptions psdOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
//Set the CompressionMethod as RLE
//Note: Other supported CompressionMethod is CompressionMethod.RAW [No Compression]
psdOptions.CompressionMethod = Aspose.Imaging.FileFormats.Psd.CompressionMethod.RLE;
//Set the ColorMode to GrayScale
//Note: Other supported ColorModes are ColorModes.Bitmap and ColorModes.RGB
psdOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Grayscale;
//Save the image to disk location with supplied PsdOptions settings
image.Save(dir + "output.psd", psdOptions);
}
Este exemplo mostra como salvar uma imagem PNG para o formato PSD usando várias opções específicas do PSD.
string dir = "c:\\temp\\";
// Create a PNG image of 100x100 px.
using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100, Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha))
{
// Define a linear blue-transparent gradient.
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);
// Fill the PNG image with the linear blue-transparent gradient.
graphics.FillRectangle(gradientBrush, pngImage.Bounds);
// The following options will be used to save the PNG image to PSD format.
Aspose.Imaging.ImageOptions.PsdOptions saveOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
// The number of bits per channel
saveOptions.ChannelBitsCount = 8;
// The number of channels. One channel for each color component R,G,B,A
saveOptions.ChannelsCount = 4;
// The color mode
saveOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Rgb;
// No compression
saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.Raw;
// Default version is 6
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"))
{
// The RLE compression allows to reduce the size of the output image
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);
}
// The output may look like this:
// The size of the PSD image with RAW compression: 40090
// The size of the PSD image with RLE compression: 16185
}
CompressionMethod
Obter ou definir o método de compressão psd.
public CompressionMethod CompressionMethod { get; set; }
Valor da propriedade
Examples
Este exemplo demonstra o uso de Aspsoe.Imaging para .Net API para converter Imagens em formato PSD. Para atingir este objetivo, este exemplo carrega uma imagem existente e, em seguida, a salva de volta ao formato PSD.
string dir = "c:\\temp\\";
//Creates an instance of image class and initialize it with an existing file through File path
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.bmp"))
{
//Create an instance of PsdOptions class
Aspose.Imaging.ImageOptions.PsdOptions psdOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
//Set the CompressionMethod as RLE
//Note: Other supported CompressionMethod is CompressionMethod.RAW [No Compression]
psdOptions.CompressionMethod = Aspose.Imaging.FileFormats.Psd.CompressionMethod.RLE;
//Set the ColorMode to GrayScale
//Note: Other supported ColorModes are ColorModes.Bitmap and ColorModes.RGB
psdOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Grayscale;
//Save the image to disk location with supplied PsdOptions settings
image.Save(dir + "output.psd", psdOptions);
}
Este exemplo mostra como salvar uma imagem PNG para o formato PSD usando várias opções específicas do PSD.
string dir = "c:\\temp\\";
// Create a PNG image of 100x100 px.
using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100, Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha))
{
// Define a linear blue-transparent gradient.
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);
// Fill the PNG image with the linear blue-transparent gradient.
graphics.FillRectangle(gradientBrush, pngImage.Bounds);
// The following options will be used to save the PNG image to PSD format.
Aspose.Imaging.ImageOptions.PsdOptions saveOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
// The number of bits per channel
saveOptions.ChannelBitsCount = 8;
// The number of channels. One channel for each color component R,G,B,A
saveOptions.ChannelsCount = 4;
// The color mode
saveOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Rgb;
// No compression
saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.Raw;
// Default version is 6
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"))
{
// The RLE compression allows to reduce the size of the output image
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);
}
// The output may look like this:
// The size of the PSD image with RAW compression: 40090
// The size of the PSD image with RLE compression: 16185
}
PsdVersion
Obter ou definir a versão do formato de arquivo. pode ser PSD ou PSB.
public PsdVersion PsdVersion { get; set; }
Valor da propriedade
RefreshImagePreviewData
Obter ou definir um valor indicando se [refresh image preview data] - opção usada para maximizar a compatibilidade com outros visualizadores de imagem PSD.Por favor, note que as camadas de texto desenhadas para o layout final não são suportadas para a plataforma Compact Framework
public bool RefreshImagePreviewData { get; set; }
Valor da propriedade
RemoveGlobalTextEngineResource
Obtenha ou coloca um valor indicando se - Remova a fonte do motor de texto global - Usado para alguns arquivos psd com camada de texto, apenas no caso, quando eles não podem ser abertos em Adobe Photoshop após o processamento (principalmente para fontes ausentes camadas de texto relacionados).Depois de usar esta opção, o usuário precisa fazer o seguinte em aberto no arquivo do Photoshop: Menu “Texto” -> “Processo ausente fonts”.Por favor, note que esta operação pode causar algumas alterações finais no layout.
public bool RemoveGlobalTextEngineResource { get; set; }
Valor da propriedade
VectorizationOptions
Obter ou definir as opções de vectorização do PSD.
public PsdVectorizationOptions VectorizationOptions { get; set; }
Valor da propriedade
Version
Obter ou definir a versão do arquivo PSD.
public int Version { get; set; }
Valor da propriedade
Examples
Este exemplo mostra como salvar uma imagem PNG para o formato PSD usando várias opções específicas do PSD.
string dir = "c:\\temp\\";
// Create a PNG image of 100x100 px.
using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100, Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha))
{
// Define a linear blue-transparent gradient.
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);
// Fill the PNG image with the linear blue-transparent gradient.
graphics.FillRectangle(gradientBrush, pngImage.Bounds);
// The following options will be used to save the PNG image to PSD format.
Aspose.Imaging.ImageOptions.PsdOptions saveOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
// The number of bits per channel
saveOptions.ChannelBitsCount = 8;
// The number of channels. One channel for each color component R,G,B,A
saveOptions.ChannelsCount = 4;
// The color mode
saveOptions.ColorMode = Aspose.Imaging.FileFormats.Psd.ColorModes.Rgb;
// No compression
saveOptions.CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.Raw;
// Default version is 6
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"))
{
// The RLE compression allows to reduce the size of the output image
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);
}
// The output may look like this:
// The size of the PSD image with RAW compression: 40090
// The size of the PSD image with RLE compression: 16185
}
XmpData
Obter ou configurar um contêiner de dados XMP
public override XmpPacketWrapper XmpData { get; set; }