Class PsdOptions
Името на пространството: Aspose.Imaging.ImageOptions Асамблея: Aspose.Imaging.dll (25.4.0)
Създаване на Photoshop Document (PSD) изображения с нашия API, предлагайки разнообразни опциис различни формати, компресионни методи, цветови режими иБитове се броят по цветен канал. Безопасно се справят с XMP метаданните контейнери,Осигуряване на цялостна обработка на изображения с мощта на функциите на PSD форматкато слоеве на изображение, слой маски и информация за файлове за персонализиранеКреативността в дизайна ви.
[JsonObject(MemberSerialization.OptIn)]
public class PsdOptions : ImageOptionsBase, IDisposable, IHasXmpData, IHasMetadata, ICloneable
Inheritance
object ← DisposableObject ← ImageOptionsBase ← PsdOptions
Implements
IDisposable , IHasXmpData , IHasMetadata , ICloneable
наследници
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
Този пример демонстрира използването на Aspsoe.Imaging за .Net API за конвертиране на изображения в PSD формат. За да се постигне тази цел, този пример зарежда съществуваща картина и след това я съхранява обратно във формата на 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);
}
Следващият пример показва как да се конвертира многостранен вектор на изображението в PSD формат като цяло, без позоваване на конкретен тип изображение.
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()
Иницијализира нова инстанция на Aspose.Imaging.ImageOptions.PsdOption клас.
[JsonConstructor]
public PsdOptions()
PsdOptions(PsdOptions)
Иницијализира нова инстанция на Aspose.Imaging.ImageOptions.PsdOption клас.
public PsdOptions(PsdOptions options)
Parameters
options
PsdOptions
и възможностите.
Properties
ChannelBitsCount
Получава или задава броя на битите по цветен канал.
public short ChannelBitsCount { get; set; }
стойност на имота
Examples
Този пример показва как да се запази PNG изображение в PSD формат, като се използват различни опции, специфични за 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
Получавате или задавате броя на цветовите канали.
public short ChannelsCount { get; set; }
стойност на имота
Examples
Този пример показва как да се запази PNG изображение в PSD формат, като се използват различни опции, специфични за 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
Получава или задава режим на цвят PSD.
public ColorModes ColorMode { get; set; }
стойност на имота
Examples
Този пример демонстрира използването на Aspsoe.Imaging за .Net API за конвертиране на изображения в PSD формат. За да се постигне тази цел, този пример зарежда съществуваща картина и след това я съхранява обратно във формата на 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);
}
Този пример показва как да се запази PNG изображение в PSD формат, като се използват различни опции, специфични за 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
Получава или поставя метода за компресия на PSD.
public CompressionMethod CompressionMethod { get; set; }
стойност на имота
Examples
Този пример демонстрира използването на Aspsoe.Imaging за .Net API за конвертиране на изображения в PSD формат. За да се постигне тази цел, този пример зарежда съществуваща картина и след това я съхранява обратно във формата на 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);
}
Този пример показва как да се запази PNG изображение в PSD формат, като се използват различни опции, специфични за 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
Получава или задава формата на файла версия. може да бъде PSD или PSB.
public PsdVersion PsdVersion { get; set; }
стойност на имота
RefreshImagePreviewData
Получава или задава стойност, която показва дали [пренасочване на данни за преглед на изображението] - опция, използвана за максимизиране на съвместимостта с други PSD изображения.Моля, имайте предвид, че текстовите слоеве, рисувани до крайното оформление, не се поддържат за платформата Compact Framework.
public bool RefreshImagePreviewData { get; set; }
стойност на имота
RemoveGlobalTextEngineResource
Получава или задава стойност, която показва дали - Премахване на световния ресурс на текстовия двигател - Използва се за някои текстово слоеви PSD файлове, само в случая, когато те не могат да бъдат отворени в Adobe Photoshop след обработката (особено за отсъстващи шрифтове, свързани с текстови слои).След като използвате тази опция, потребителят трябва да направи следващото в отворен в Photoshop файл: Меню “текст” -> “Процес отсъства шрифтове”.Моля, имайте предвид, че тази операция може да доведе до някои окончателни промени в оформлението.
public bool RemoveGlobalTextEngineResource { get; set; }
стойност на имота
VectorizationOptions
Получава или поставя опциите за PSD векторизация.
public PsdVectorizationOptions VectorizationOptions { get; set; }
стойност на имота
Version
Получава или задава версия на PDF файла.
public int Version { get; set; }
стойност на имота
Examples
Този пример показва как да се запази PNG изображение в PSD формат, като се използват различни опции, специфични за 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
Вземете или задайте XMP контейнер за данни
public override XmpPacketWrapper XmpData { get; set; }