PngOptions Class |
Namespace: Aspose.PSD.ImageOptions
The PngOptions type exposes the following members.
Name | Description | |
---|---|---|
![]() | PngOptions |
Initializes a new instance of the PngOptions class.
|
![]() | PngOptions(PngOptions) |
Initializes a new instance of the PngOptions class.
|
Name | Description | |
---|---|---|
![]() | BitDepth |
The bit depth.
|
![]() | BufferSizeHint |
Gets or sets the buffer size hint which is defined max allowed size for all internal buffers.
(Inherited from ImageOptionsBase.) |
![]() | ColorType |
Gets or sets the type of the color.
|
![]() | CompressionLevel |
The png image compression level in the 0-9 range, where 9 is maximum compression and 0 is store mode.
|
![]() ![]() | DefaultReplacementFont |
Gets or sets the default replacement font (font that will be used to draw text when exporting to raster, if existing layer font in PSD file is not presented in system).
To take proper name of default font can be used next code snippet:
System.Drawing.Text.InstalledFontCollection col = new System.Drawing.Text.InstalledFontCollection();
System.Drawing.FontFamily[] families = col.Families;
string defaultFontName = families[0].Name;
PsdLoadOptions psdLoadOptions = new PsdLoadOptions() { DefaultReplacementFont = defaultFontName });
(Inherited from ImageOptionsBase.) |
![]() | Disposed |
Gets a value indicating whether this instance is disposed.
(Inherited from DisposableObject.) |
![]() | FilterType |
Gets or sets the filter type used during png file save process.
|
![]() | FullFrame |
Gets or sets a value indicating whether [full frame].
(Inherited from ImageOptionsBase.) |
![]() | MultiPageOptions |
The multipage options
(Inherited from ImageOptionsBase.) |
![]() | Palette |
Gets or sets the color palette.
(Inherited from ImageOptionsBase.) |
![]() | ProgressEventHandler |
Gets or sets the progress event handler.
(Inherited from ImageOptionsBase.) |
![]() | Progressive |
Gets or sets a value indicating whether this PngOptions is progressive.
|
![]() | ResolutionSettings |
Gets or sets the resolution settings.
(Inherited from ImageOptionsBase.) |
![]() | Source |
Gets or sets the source to create image in.
(Inherited from ImageOptionsBase.) |
![]() | VectorRasterizationOptions |
Gets or sets the vector rasterization options.
(Inherited from ImageOptionsBase.) |
![]() | XmpData |
Gets or sets the XMP metadata container.
(Overrides ImageOptionsBaseXmpData.) |
Name | Description | |
---|---|---|
![]() | Clone |
Clones this instance.
(Inherited from ImageOptionsBase.) |
![]() | Dispose |
Disposes the current instance.
(Inherited from DisposableObject.) |
![]() | Equals | (Inherited from Object.) |
![]() | Finalize | (Inherited from DisposableObject.) |
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetType | (Inherited from Object.) |
![]() | MemberwiseClone | (Inherited from Object.) |
![]() | ReleaseManagedResources |
Releases the managed resources. Make sure no unmanaged resources are released here, since they may have been already released.
(Inherited from ImageOptionsBase.) |
![]() | ReleaseUnmanagedResources |
Releases the unmanaged resources. Make sure no managed resources are released here, since they may have been already released.
(Inherited from DisposableObject.) |
![]() | ToString | (Inherited from Object.) |
![]() | VerifyNotDisposed |
Verifies that the current instance is not disposed.
(Inherited from DisposableObject.) |
Name | Description | |
---|---|---|
![]() ![]() | DefaultCompressionLevel |
The default compression level.
|
![]() | xmpData |
XMP metadata of image.
(Inherited from ImageOptionsBase.) |
[C#] string sourceFileName = "form_8.ai"; string outputFileName = "form_8_export"; using (AiImage image = (AiImage)Image.Load(sourceFileName)) { image.Save(outputFileName + ".psd", new PsdOptions()); image.Save(outputFileName + ".png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha }); }
[C#] //Load an existing image in an instance of Image class using (Aspose.PSD.Image image = Aspose.PSD.Image.Load(@"C:\temp\image.psd")) { //Export to BMP file format using the default options image.Save(@"C:\temp\output.bmp", new Aspose.PSD.ImageOptions.BmpOptions()); //Export to JPEG file format using the default options image.Save(@"C:\temp\output.jpeg", new Aspose.PSD.ImageOptions.JpegOptions()); //Export to JPEG 2000 file format using the default options image.Save(@"C:\temp\output.jp2", new Aspose.PSD.ImageOptions.Jpeg2000Options()); //Export to PNG file format using the default options image.Save(@"C:\temp\output.png", new Aspose.PSD.ImageOptions.PngOptions()); //Export to TIFF file format using the default options image.Save(@"c:\temp\output.tiff", new Aspose.PSD.ImageOptions.TiffOptions(Aspose.PSD.FileFormats.Tiff.Enums.TiffExpectedFormat.Default)); }
[C#] string sourceFileName = "Apple.psd"; string outputFileName = "OutputApple"; using (PsdImage image = (PsdImage)Image.Load(sourceFileName)) { if (image.Layers.Length < 23) { throw new Exception("There is not 23rd layer."); } var layer = image.Layers[23] as LayerGroup; if (layer == null) { throw new Exception("The 23rd layer is not a layer group."); } if (layer.Name != "AdjustmentGroup") { throw new Exception("The 23rd layer name is not 'AdjustmentGroup'."); } if (layer.BlendModeKey != BlendMode.PassThrough) { throw new Exception("AdjustmentGroup layer should have 'pass through' blend mode."); } image.Save(outputFileName + ".psd", new PsdOptions(image)); image.Save(outputFileName + ".png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha }); layer.BlendModeKey = BlendMode.Normal; image.Save(outputFileName + "Normal.psd", new PsdOptions(image)); image.Save(outputFileName + "Normal.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha }); }
[C#] string sourceFilePath = "Apple.psd"; Stream outputStream = new MemoryStream(); Aspose.PSD.ProgressEventHandler localProgressEventHandler = delegate(ProgressEventHandlerInfo progressInfo) { string message = string.Format( "{0} {1}: {2} out of {3}", progressInfo.Description, progressInfo.EventType, progressInfo.Value, progressInfo.MaxValue); Console.WriteLine(message); }; Console.WriteLine("---------- Loading Apple.psd ----------"); var loadOptions = new PsdLoadOptions() { ProgressEventHandler = localProgressEventHandler }; using (PsdImage image = (PsdImage)Image.Load(sourceFilePath, loadOptions)) { Console.WriteLine("---------- Saving Apple.psd to PNG format ----------"); image.Save( outputStream, new PngOptions() { ColorType = PngColorType.Truecolor, ProgressEventHandler = localProgressEventHandler }); Console.WriteLine("---------- Saving Apple.psd to PSD format ----------"); image.Save( outputStream, new PsdOptions() { ColorMode = ColorModes.Rgb, ChannelsCount = 4, ProgressEventHandler = localProgressEventHandler }); }
[C#] //Create an instance of Image using (Aspose.PSD.Image image = new Aspose.PSD.FileFormats.Psd.PsdImage(500, 500)) { //Create and initialize an instance of Graphics class Aspose.PSD.Graphics graphics = new Aspose.PSD.Graphics(image); //Clear Graphics surface graphics.Clear(Color.Wheat); //Draw an Arc by specifying the Pen object having Black color, //a Rectangle surrounding the Arc, Start Angle and Sweep Angle graphics.DrawArc(new Pen(Color.Black, 2), new Rectangle(200, 200, 100, 200), 0, 300); //Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points. graphics.DrawBezier(new Pen(Color.Blue, 2), new Point(250, 100), new Point(300, 30), new Point(450, 100), new Point(235, 25)); //Draw a Curve by specifying the Pen object having Green color and an array of Points graphics.DrawCurve(new Pen(Color.Green, 2), new[] { new Point(100, 200), new Point(100, 350), new Point(200, 450) }); //Draw an Ellipse using the Pen object and a surrounding Rectangle graphics.DrawEllipse(new Pen(Color.Yellow, 2), new Rectangle(300, 300, 100, 100)); //Draw a Line graphics.DrawLine(new Pen(Color.Violet, 2), new Point(100, 100), new Point(200, 200)); //Draw a Pie segment graphics.DrawPie(new Pen(Color.Silver, 2), new Rectangle(new Point(200, 20), new Size(200, 200)), 0, 45); //Draw a Polygon by specifying the Pen object having Red color and an array of Points graphics.DrawPolygon(new Pen(Color.Red, 2), new[] { new Point(20, 100), new Point(20, 200), new Point(220, 20) }); //Draw a Rectangle graphics.DrawRectangle(new Pen(Color.Orange, 2), new Rectangle(new Point(250, 250), new Size(100, 100))); //Create a SolidBrush object and set its various properties Aspose.PSD.Brushes.SolidBrush brush = new Aspose.PSD.Brushes.SolidBrush(); brush.Color = Color.Purple; brush.Opacity = 100; //Draw a String using the SolidBrush object and Font, at specific Point graphics.DrawString("This image is created by Aspose.PSD API", new Font("Times New Roman", 16), brush, new PointF(50, 400)); //Create an instance of PngOptions and set its various properties Aspose.PSD.ImageOptions.PngOptions pngOptions = new Aspose.PSD.ImageOptions.PngOptions(); // save all changes. image.Save("C:\\temp\\output.png", pngOptions); }