Class PngImage

Class PngImage

ชื่อพื้นที่: Aspose.Imaging.FileFormats.Png การประกอบ: Aspose.Imaging.dll (25.4.0)

การจัดการกราฟิกเครือข่ายแบบพกพา (PNG) รูปแบบสกรูด้วย API ที่หลากหลายของเรามีการสนับสนุนสําหรับระดับการบีบอัดและความลึกสีต่างๆรวมถึงGrayscale, Color Indexed, TrueColor, และช่องอัลฟา การประมวลผล metadata XMP โดยไม่มีการเชื่อมต่อช่วยให้การจัดการ metadata ภาพที่ครอบคลุมในขณะที่โหลดภาพ PNG ได้ง่ายการดําเนินการการจัดการต่างๆ การใช้งานกรองและการแปลงภาพไปยังไฟล์อื่น ๆรูปแบบสําหรับความหลากหลายและกําหนดเองที่เหมาะสม

[JsonObject(MemberSerialization.OptIn)]
public class PngImage : RasterCachedImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata

Inheritance

object DisposableObject DataStreamSupporter Image RasterImage RasterCachedImage PngImage

Implements

IDisposable , IObjectWithBounds , IRasterImageArgb32PixelLoader , IRasterImageRawDataLoader , IHasXmpData , IHasMetadata

อนุญาโตตุลาการ

RasterCachedImage.CacheData() , RasterCachedImage.Blend(Point, RasterImage, Rectangle, byte) , RasterCachedImage.Resize(int, int, ResizeType) , RasterCachedImage.Resize(int, int, ImageResizeSettings) , RasterCachedImage.RotateFlip(RotateFlipType) , RasterCachedImage.Rotate(float, bool, Color) , RasterCachedImage.Crop(Rectangle) , RasterCachedImage.Dither(DitheringMethod, int, IColorPalette) , RasterCachedImage.Grayscale() , RasterCachedImage.NormalizeHistogram() , RasterCachedImage.BinarizeFixed(byte) , RasterCachedImage.BinarizeOtsu() , RasterCachedImage.BinarizeBradley(double, int) , RasterCachedImage.BinarizeBradley(double) , RasterCachedImage.AdjustBrightness(int) , RasterCachedImage.AdjustContrast(float) , RasterCachedImage.AdjustGamma(float, float, float) , RasterCachedImage.AdjustGamma(float) , RasterCachedImage.OnCached() , RasterCachedImage.OnPaletteChanged(IColorPalette, IColorPalette) , RasterCachedImage.IsCached , RasterImage.xmpData , RasterImage.RemoveMetadata() , RasterImage.Save(Stream, ImageOptionsBase, Rectangle) , RasterImage.GetModifyDate(bool) , RasterImage.Dither(DitheringMethod, int) , RasterImage.Dither(DitheringMethod, int, IColorPalette) , RasterImage.GetDefaultPixels(Rectangle, IPartialArgb32PixelLoader) , RasterImage.GetDefaultRawData(Rectangle, IPartialRawDataLoader, RawDataSettings) , RasterImage.GetDefaultArgb32Pixels(Rectangle) , RasterImage.GetDefaultRawData(Rectangle, RawDataSettings) , RasterImage.GetArgb32Pixel(int, int) , RasterImage.GetPixel(int, int) , RasterImage.SetArgb32Pixel(int, int, int) , RasterImage.SetPixel(int, int, Color) , RasterImage.ReadScanLine(int) , RasterImage.ReadArgb32ScanLine(int) , RasterImage.WriteScanLine(int, Color[]) , RasterImage.WriteArgb32ScanLine(int, int[]) , RasterImage.LoadPartialArgb32Pixels(Rectangle, IPartialArgb32PixelLoader) , RasterImage.LoadPartialPixels(Rectangle, IPartialPixelLoader) , RasterImage.LoadArgb32Pixels(Rectangle) , RasterImage.LoadArgb64Pixels(Rectangle) , RasterImage.LoadPartialArgb64Pixels(Rectangle, IPartialArgb64PixelLoader) , RasterImage.LoadPixels(Rectangle) , RasterImage.LoadCmykPixels(Rectangle) , RasterImage.LoadCmyk32Pixels(Rectangle) , RasterImage.LoadRawData(Rectangle, RawDataSettings, IPartialRawDataLoader) , RasterImage.LoadRawData(Rectangle, Rectangle, RawDataSettings, IPartialRawDataLoader) , RasterImage.SaveRawData(byte[], int, Rectangle, RawDataSettings) , RasterImage.SaveArgb32Pixels(Rectangle, int[]) , RasterImage.SavePixels(Rectangle, Color[]) , RasterImage.SaveCmykPixels(Rectangle, CmykColor[]) , RasterImage.SaveCmyk32Pixels(Rectangle, int[]) , RasterImage.SetResolution(double, double) , RasterImage.SetPalette(IColorPalette, bool) , RasterImage.Resize(int, int, ImageResizeSettings) , RasterImage.Rotate(float, bool, Color) , RasterImage.Rotate(float) , RasterImage.BinarizeFixed(byte) , RasterImage.BinarizeOtsu() , RasterImage.BinarizeBradley(double) , RasterImage.BinarizeBradley(double, int) , RasterImage.Blend(Point, RasterImage, Rectangle, byte) , RasterImage.Blend(Point, RasterImage, byte) , RasterImage.Grayscale() , RasterImage.NormalizeHistogram() , RasterImage.AdjustBrightness(int) , RasterImage.AdjustContrast(float) , RasterImage.AdjustGamma(float, float, float) , RasterImage.AdjustGamma(float) , RasterImage.GetSkewAngle() , RasterImage.NormalizeAngle() , RasterImage.NormalizeAngle(bool, Color) , RasterImage.Filter(Rectangle, FilterOptionsBase) , RasterImage.ReplaceColor(Color, byte, Color) , RasterImage.ReplaceColor(int, byte, int) , RasterImage.ReplaceNonTransparentColors(Color) , RasterImage.ReplaceNonTransparentColors(int) , RasterImage.ToBitmap() , RasterImage.ReleaseManagedResources() , RasterImage.UpdateMetadata() , RasterImage.UpdateDimensions(int, int) , RasterImage.PremultiplyComponents , RasterImage.UseRawData , RasterImage.UpdateXmpData , RasterImage.XmpData , RasterImage.RawIndexedColorConverter , RasterImage.RawCustomColorConverter , RasterImage.RawFallbackIndex , RasterImage.RawDataSettings , RasterImage.UsePalette , RasterImage.RawDataFormat , RasterImage.RawLineSize , RasterImage.IsRawDataAvailable , RasterImage.HorizontalResolution , RasterImage.VerticalResolution , RasterImage.HasTransparentColor , RasterImage.HasAlpha , RasterImage.TransparentColor , RasterImage.ImageOpacity , RasterImage.DataLoader , Image.CanLoad(string) , Image.CanLoad(string, LoadOptions) , Image.CanLoad(Stream) , Image.CanLoad(Stream, LoadOptions) , Image.Create(ImageOptionsBase, int, int) , Image.Create(Image[]) , Image.Create(MultipageCreateOptions) , Image.Create(string[], bool) , Image.Create(string[]) , Image.Create(Image[], bool) , Image.GetFileFormat(string) , Image.GetFileFormat(Stream) , Image.GetFittingRectangle(Rectangle, int, int) , Image.GetFittingRectangle(Rectangle, int[], int, int) , Image.Load(string, LoadOptions) , Image.Load(string) , Image.Load(Stream, LoadOptions) , Image.Load(Stream) , Image.GetProportionalWidth(int, int, int) , Image.GetProportionalHeight(int, int, int) , Image.RemoveMetadata() , Image.CanSave(ImageOptionsBase) , Image.Resize(int, int) , Image.Resize(int, int, ResizeType) , Image.Resize(int, int, ImageResizeSettings) , Image.GetDefaultOptions(object[]) , Image.GetOriginalOptions() , Image.ResizeWidthProportionally(int) , Image.ResizeHeightProportionally(int) , Image.ResizeWidthProportionally(int, ResizeType) , Image.ResizeHeightProportionally(int, ResizeType) , Image.ResizeWidthProportionally(int, ImageResizeSettings) , Image.ResizeHeightProportionally(int, ImageResizeSettings) , Image.RotateFlip(RotateFlipType) , Image.Rotate(float) , Image.Crop(Rectangle) , Image.Crop(int, int, int, int) , Image.Save() , Image.Save(string) , Image.Save(string, ImageOptionsBase) , Image.Save(string, ImageOptionsBase, Rectangle) , Image.Save(Stream, ImageOptionsBase) , Image.Save(Stream, ImageOptionsBase, Rectangle) , Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int) , Image.SetPalette(IColorPalette, bool) , Image.UpdateContainer(Image) , Image.GetCanNotSaveMessage(ImageOptionsBase) , Image.GetFitRectangle(Rectangle) , Image.GetImage2Export(ImageOptionsBase, Rectangle, IImageExporter) , Image.GetFitRectangle(Rectangle, int[]) , Image.OnPaletteChanged(IColorPalette, IColorPalette) , Image.OnPaletteChanging(IColorPalette, IColorPalette) , Image.ReleaseManagedResources() , Image.BitsPerPixel , Image.Bounds , Image.Container , Image.Height , Image.Palette , Image.UsePalette , Image.Size , Image.Width , Image.InterruptMonitor , Image.BufferSizeHint , Image.AutoAdjustPalette , Image.HasBackgroundColor , Image.FileFormat , Image.BackgroundColor , DataStreamSupporter.timeout , DataStreamSupporter.CacheData() , DataStreamSupporter.Save() , DataStreamSupporter.Save(Stream) , DataStreamSupporter.Save(string) , DataStreamSupporter.Save(string, bool) , DataStreamSupporter.SaveData(Stream) , DataStreamSupporter.ReleaseManagedResources() , DataStreamSupporter.OnDataStreamContainerChanging(StreamContainer) , DataStreamSupporter.DataStreamContainer , DataStreamSupporter.IsCached , 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

ตัวอย่างนี้แสดงให้เห็นวิธีการโหลดภาพ PNG จากไฟล์

string dir = "c:\\temp\\";

                                                                  // Load a PNG image from a file.
                                                                  using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(dir + "sample.png"))
                                                                  {
                                                                      // Transform the image to grayscale representation
                                                                      pngImage.Grayscale();

                                                                      // Save to a file.
                                                                      pngImage.Save(dir + "sample.grayscale.png");
                                                                  }

Constructors

PngImage(int, int)

เริ่มต้นวัตถุใหม่ของคลาส Aspose.Imaging.FileFormats.Png.PngImage โดยการจัดหาความกว้างและความสูงพารามิเตอร์ ผู้ก่อสร้างนี้ช่วยให้การสร้าง PNG ได้ง่ายขึ้นภาพโดยช่วยให้ผู้พัฒนาสามารถระบุขนาดโดยตรงการจัดการข้อมูลภาพ PNG ในแอพลิเคชันของพวกเขาได้อย่างมีประสิทธิภาพ

public PngImage(int width, int height)

Parameters

width int

ความกว้าง

height int

ความสูง

Examples

ตัวอย่างนี้แสดงให้เห็นวิธีการสร้างภาพ PNG ขนาดที่ระบุเติมด้วยสีที่แข็งแกร่งและบันทึกไว้ในไฟล์

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))
                                                                                                                                {
                                                                                                                                    // Do some image processing, e.g. fill the entire image in red.
                                                                                                                                    Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(pngImage);
                                                                                                                                    Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                                                                    graphics.FillRectangle(brush, pngImage.Bounds);

                                                                                                                                    // Save to a file.
                                                                                                                                    pngImage.Save(dir + "output.png");
                                                                                                                                }

PngImage(รั้ว)

สร้างตัวอย่างใหม่ของคลาส Aspose.Imaging.FileFormats.Png.PngImage โดยใช้เส้นทางพารามิเตอร์เพื่อระบุตําแหน่งของไฟล์ภาพที่จะโหลด ตัวสร้างนี้ช่วยให้ผู้พัฒนาสามารถสร้างภาพ PNG ได้อย่างสะดวกโดยโหลดภาพจากไฟล์การซับซ้อนกระบวนการทํางานกับภาพ PNG ในแอพพลิเคชันของพวกเขา

public PngImage(string path)

Parameters

path string

วิธีที่จะโหลดภาพ

Examples

ตัวอย่างนี้แสดงให้เห็นวิธีการโหลดภาพ PNG จากไฟล์

string dir = "c:\\temp\\";

                                                                  // Load a PNG image from a file.
                                                                  using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(dir + "sample.png"))
                                                                  {
                                                                      // Transform the image to grayscale representation
                                                                      pngImage.Grayscale();

                                                                      // Save to a file.
                                                                      pngImage.Save(dir + "sample.grayscale.png");
                                                                  }

PngImage(RasterImage)

สร้างตัวอย่างใหม่ของคลาส Aspose.Imaging.FileFormats.Png.PngImage โดยการจัดหาตัวอย่างรูปภาพเป็นพารามิเตอร์ ผู้สร้างนี้ช่วยให้ผู้พัฒนาสามารถเปิดตัวได้โดยตรงวัตถุภาพ PNG ใช้ภาพเรสเตอร์ที่มีอยู่ทําให้กระบวนการของการทํางานกับภาพ PNG ในแอพพลิเคชันของพวกเขา

public PngImage(RasterImage rasterImage)

Parameters

rasterImage RasterImage

รูปภาพสกรู

Examples

ตัวอย่างนี้แสดงให้เห็นวิธีการโหลดภาพ PNG จากภาพ BMP

string dir = "c:\\temp\\";

                                                                     // Load a TrueColor PNG image from a BMP image.
                                                                     // First, create a temporal BMP image that will be a foundation for building a PNG image.
                                                                     // You can also load BMP image from a file or use an image of any other raster format.
                                                                     using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                     {
                                                                         // Fill the entire BMP image in red.
                                                                         Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(bmpImage);
                                                                         Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                         gr.FillRectangle(brush, bmpImage.Bounds);

                                                                         using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(bmpImage))
                                                                         {
                                                                             System.Console.WriteLine("The PNG color type: {0}", pngImage.GetOriginalOptions());
                                                                             pngImage.Save(dir + "output.png");
                                                                         }
                                                                     }

PngImage(ลวด, PngColorType)

เปิดตัวตัวอย่างใหม่ของคลาส Aspose.Imaging.FileFormats.Png.PngImage โดยระบุเส้นทางไปยังไฟล์ภาพและประเภทสี ผู้สร้างนี้ช่วยให้สะดวกสบายการสร้างภาพ PNG จากไฟล์ที่มีประเภทสีที่แตกต่างกันความยืดหยุ่นในการจัดการรูปแบบภาพต่างๆ

public PngImage(string path, PngColorType colorType)

Parameters

path string

วิธีที่จะโหลดภาพ

colorType PngColorType

ประเภทสี

Examples

ตัวอย่างนี้แสดงให้เห็นวิธีการโหลดภาพ PNG จากไฟล์ที่มีประเภทสีที่ระบุ

string dir = "c:\\temp\\";

                                                                                                // Load a PNG image from a file.
                                                                                                // Note that the colorful image will be converted to grayscale automatically.
                                                                                                using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(dir + "sample.png", Aspose.Imaging.FileFormats.Png.PngColorType.Grayscale))
                                                                                                {
                                                                                                    // Save to a file.
                                                                                                    pngImage.Save(dir + "sample.grayscale.png");
                                                                                                }

Exceptions

ArgumentNullException

PngImage(RasterImage, PngColorประเภท)

สร้างตัวอย่างใหม่ของคลาส Aspose.Imaging.FileFormats.Png.PngImage โดยระบุภาพ raster และประเภทสี ผู้สร้างนี้ช่วยให้ผู้พัฒนาได้โดยตรงแปลงภาพ raster ในรูปแบบ PNG ในขณะที่ระบุประเภทสีที่ต้องการให้ความยืดหยุ่นในการแสดงสี

public PngImage(RasterImage rasterImage, PngColorType colorType)

Parameters

rasterImage RasterImage

รูปภาพสกรู

colorType PngColorType

ประเภทสี

Examples

ตัวอย่างนี้แสดงให้เห็นวิธีการโหลดภาพ PNG จากภาพ BMP ด้วยประเภทสีที่ระบุ

string dir = "c:\\temp\\";

                                                                                                   // Load a grayscale PNG image from a colored BMP image.
                                                                                                   // First, create a temporal BMP image that will be a foundation for building a PNG image.
                                                                                                   // You can also load BMP image from a file or use an image of any other raster format.
                                                                                                   using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                                                   {
                                                                                                       // Fill the entire BMP image in red.
                                                                                                       Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(bmpImage);
                                                                                                       Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                                       gr.FillRectangle(brush, bmpImage.Bounds);

                                                                                                       // The colors of the image pixels will be converted to their grayscale counterparts.
                                                                                                       using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(bmpImage, Aspose.Imaging.FileFormats.Png.PngColorType.Grayscale))
                                                                                                       {
                                                                                                           pngImage.Save(dir + "output.grayscale.png");
                                                                                                       }
                                                                                                   }

PngImage(Stream)

สร้างตัวอย่างใหม่ของคลาส Aspose.Imaging.FileFormats.Png.PngImage โดยเริ่มต้นด้วยการไหล เครื่องก่อสร้างนี้ช่วยให้ผู้พัฒนาโหลดภาพ PNG โดยตรงจากการไหลให้ความยืดหยุ่นในการถ่ายภาพจากแหล่งที่มาต่าง ๆ

public PngImage(Stream stream)

Parameters

stream Stream

กระแสเพื่อโหลดภาพ

Examples

ตัวอย่างนี้แสดงให้เห็นวิธีการโหลดภาพ PNG จากไฟล์หรือไฟล์ไหล

string dir = "c:\\temp\\";

                                                                                   // Load a PNG image from a file stream.
                                                                                   using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "sample.png"))
                                                                                   {
                                                                                       using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(stream))
                                                                                       {
                                                                                           // Transform the image to grayscale representation
                                                                                           pngImage.Grayscale();

                                                                                           // Save to a file.
                                                                                           pngImage.Save(dir + "sample.grayscale.png");
                                                                                       }
                                                                                   }

PngImage(int, int, PngColorType)

Instant a fresh instance of the Aspose.Imaging.FileFormats.Png.PngImage class, ข้อมูลจําเพาะความกว้างความสูงและพารามิเตอร์ประเภทสีที่ต้องการ ผู้ก่อสร้างนี้สามารถการสร้างภาพ PNG ได้อย่างรวดเร็วด้วยขนาดที่กําหนดเองและการกําหนดค่าสีช่วยให้การสร้างภาพที่เรียบง่ายสําหรับแอพพลิเคชันต่างๆและกระบวนการทํางาน

public PngImage(int width, int height, PngColorType colorType)

Parameters

width int

ความกว้าง

height int

ความสูง

colorType PngColorType

ประเภทสี

Examples

ตัวอย่างนี้แสดงให้เห็นวิธีการสร้างภาพ PNG ของขนาดที่ระบุด้วยประเภทสีที่ระบุเติมด้วยสีที่แข็งแกร่งและบันทึกไว้ในไฟล์

string dir = "c:\\temp\\";

                                                                                                                                                              // Create a grayscale PNG image of 100x100 px.
                                                                                                                                                              // All colors will be automatically converted to the grayscale format.
                                                                                                                                                              using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100, Aspose.Imaging.FileFormats.Png.PngColorType.Grayscale))
                                                                                                                                                              {
                                                                                                                                                                  // Do some image processing, e.g. fill the entire image in red.
                                                                                                                                                                  Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(pngImage);
                                                                                                                                                                  Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                                                                                                  graphics.FillRectangle(brush, pngImage.Bounds);

                                                                                                                                                                  // Save to a file.
                                                                                                                                                                  pngImage.Save(dir + "output.grayscale.png");
                                                                                                                                                              }

PngImage(PngOptions, int, int)

เปิดตัวตัวอย่างใหม่ของคลาส Aspose.Imaging.FileFormats.Png.PngImage รวมถึงตัวเลือก PNG พร้อมกับพารามิเตอร์ความกว้างและความสูง ผู้ก่อสร้างนี้ช่วยผู้พัฒนาเพื่อสร้างภาพ PNG ด้วยการตั้งค่าและขนาดที่กําหนดเองให้ความยืดหยุ่นในการสร้างภาพสําหรับกรณีการใช้งานที่หลากหลาย

public PngImage(PngOptions pngOptions, int width, int height)

Parameters

pngOptions PngOptions

ตัวเลือก PNG

width int

ความกว้าง

height int

ความสูง

Examples

ตัวอย่างนี้แสดงให้เห็นวิธีการสร้างภาพ PNG ด้วยตัวเลือกที่ระบุแล้วเติมด้วยสี gradient linear และบันทึกไว้ในไฟล์

string dir = "c:\\temp\\";

                                                                                                                                                Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                // The number of bits per color channel
                                                                                                                                                createOptions.BitDepth = 8;

                                                                                                                                                // Each pixel is a (red, green, blue) triple followed by the alpha component.
                                                                                                                                                createOptions.ColorType = Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha;

                                                                                                                                                // The maximum level of compression.
                                                                                                                                                createOptions.CompressionLevel = 9;

                                                                                                                                                // Usage of filters allows to compress continuous tonal images more effectively.
                                                                                                                                                createOptions.FilterType = Aspose.Imaging.FileFormats.Png.PngFilterType.Sub;

                                                                                                                                                // Use progressive loading
                                                                                                                                                createOptions.Progressive = true;

                                                                                                                                                // Create a PNG image with custom parameters.
                                                                                                                                                using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(createOptions, 100, 100))
                                                                                                                                                {
                                                                                                                                                    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 image with a semi-transparent gradient.
                                                                                                                                                    graphics.FillRectangle(gradientBrush, pngImage.Bounds);

                                                                                                                                                    // Save to a file.
                                                                                                                                                    pngImage.Save(dir + "output.explicitoptions.png");
                                                                                                                                                }

Properties

BackgroundColor

กลับสีพื้นหลังของภาพถ้าระบุไว้ คุณสมบัตินี้เป็นประโยชน์สําหรับแอพพลิเคชันที่จําเป็นต้องระบุและสามารถจัดการได้สีพื้นหลังของภาพ

public override Color BackgroundColor { get; set; }

คุณสมบัติมูลค่า

Color

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นวิธีการตั้งสีโปร่งใสอย่างสมบูรณ์สําหรับส่วนของภาพ TrueColor PNG ซึ่งไม่สนับสนุนช่องอัลฟา

Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                                                   createOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\transparent.png", false);
                                                                                                                                                   createOptions.ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.Truecolor;

                                                                                                                                                   // Create a TrueColor PNG image of 100x100 px.
                                                                                                                                                   using (Aspose.Imaging.Image image = Image.Create(createOptions, 100, 100))
                                                                                                                                                   {
                                                                                                                                                       Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;
                                                                                                                                                       Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);

                                                                                                                                                       // All red pixels will be considered as fully transparent.
                                                                                                                                                       pngImage.TransparentColor = Aspose.Imaging.Color.Red;
                                                                                                                                                       pngImage.HasTransparentColor = true;

                                                                                                                                                       // All transparent pixels will have a background color.
                                                                                                                                                       pngImage.BackgroundColor = Aspose.Imaging.Color.Green;
                                                                                                                                                       pngImage.HasBackgroundColor = true;

                                                                                                                                                       // Fill the entire image with white color.
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White), pngImage.Bounds);

                                                                                                                                                       // Fill the top-left quarter of the image with the transparent color.
                                                                                                                                                       // This makes the top-left quarter colored in the background color.
                                                                                                                                                       Rectangle rect = new Rectangle(0, 0, pngImage.Width / 2, pngImage.Height / 2);
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red), rect);

                                                                                                                                                       pngImage.Save();
                                                                                                                                                   }

BitsPerPixel

รับค่าบิตต่อพิกเซลสําหรับภาพ คุณสมบัตินี้ให้ความสําคัญข้อมูลเกี่ยวกับความลึกสีของภาพที่ช่วยให้ผู้พัฒนาสามารถทําความเข้าใจระดับรายละเอียดและความแม่นยําของสีที่อยู่ในข้อมูลภาพ

public override int BitsPerPixel { get; }

คุณสมบัติมูลค่า

int

FileFormat

Retreat the format of the file associated with the image ตัวอย่างนี้คุณสมบัติให้ข้อมูลที่สําคัญเกี่ยวกับประเภทไฟล์ซึ่งจะช่วยให้การจัดการและการประมวลผลที่มีประสิทธิภาพตามความต้องการรูปแบบที่เฉพาะเจาะจง

public override FileFormat FileFormat { get; }

คุณสมบัติมูลค่า

FileFormat

HasAlpha

กลับค่า boolean ที่แสดงให้เห็นว่าภาพมีช่อง alpha หรือไม่ซึ่งกําหนดความโปร่งใสของมัน คุณสมบัตินี้มีประโยชน์สําหรับการใช้งานความต้องการในการจัดการความโปร่งใสช่วยให้ผู้พัฒนาสามารถตัดสินใจว่าการประมวลผลเพิ่มเติมเป็นสิ่งจําเป็นในการจัดการพื้นที่โปร่งใสในภาพ

public override bool HasAlpha { get; }

คุณสมบัติมูลค่า

bool

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นวิธีการตรวจสอบว่าภาพ PNG สนับสนุนช่องอัลฟาหรือไม่

// Get all supported PNG color types.
                                                                                          System.Array colorTypes = System.Enum.GetValues(typeof(Aspose.Imaging.FileFormats.Png.PngColorType));

                                                                                          foreach (Aspose.Imaging.FileFormats.Png.PngColorType colorType in colorTypes)
                                                                                          {
                                                                                              Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                              createOptions.Source = new Sources.StreamSource(new System.IO.MemoryStream());
                                                                                              createOptions.ColorType = colorType;

                                                                                              using (Aspose.Imaging.Image image = Image.Create(createOptions, 100, 100))
                                                                                              {
                                                                                                  Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;

                                                                                                  if (pngImage.HasAlpha)
                                                                                                  {
                                                                                                      System.Console.WriteLine("A {0} PNG image supports alpha channel", createOptions.ColorType);
                                                                                                  }
                                                                                                  else
                                                                                                  {
                                                                                                      System.Console.WriteLine("A {0} PNG image doesn't support alpha channel", createOptions.ColorType);
                                                                                                  }
                                                                                              }
                                                                                          }

                                                                                          // The output looks like this:
                                                                                          // A Grayscale PNG image doesn't support alpha channel
                                                                                          // A Truecolor PNG image doesn't support alpha channel
                                                                                          // A IndexedColor PNG image doesn't support alpha channel
                                                                                          // A GrayscaleWithAlpha PNG image supports alpha channel
                                                                                          // A TruecolorWithAlpha PNG image supports alpha channel

HasBackgroundColor

หมายถึงค่า boolean ซึ่งแสดงให้เห็นว่าภาพมีสีพื้นหลังหรือไม่คุณสมบัตินี้มีประโยชน์สําหรับแอปพลิเคชันที่จําเป็นต้องตรวจสอบว่าภาพรวมถึงสีพื้นหลังซึ่งอาจเป็นสิ่งสําคัญสําหรับการประมวลผลต่างๆภารกิจเช่นการประกอบการ rendering หรือส่งออก

public override bool HasBackgroundColor { get; set; }

คุณสมบัติมูลค่า

bool

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นวิธีการตั้งสีโปร่งใสอย่างสมบูรณ์สําหรับส่วนของภาพ TrueColor PNG ซึ่งไม่สนับสนุนช่องอัลฟา

Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                                                   createOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\transparent.png", false);
                                                                                                                                                   createOptions.ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.Truecolor;

                                                                                                                                                   // Create a TrueColor PNG image of 100x100 px.
                                                                                                                                                   using (Aspose.Imaging.Image image = Image.Create(createOptions, 100, 100))
                                                                                                                                                   {
                                                                                                                                                       Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;
                                                                                                                                                       Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);

                                                                                                                                                       // All red pixels will be considered as fully transparent.
                                                                                                                                                       pngImage.TransparentColor = Aspose.Imaging.Color.Red;
                                                                                                                                                       pngImage.HasTransparentColor = true;

                                                                                                                                                       // All transparent pixels will have a background color.
                                                                                                                                                       pngImage.BackgroundColor = Aspose.Imaging.Color.Green;
                                                                                                                                                       pngImage.HasBackgroundColor = true;

                                                                                                                                                       // Fill the entire image with white color.
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White), pngImage.Bounds);

                                                                                                                                                       // Fill the top-left quarter of the image with the transparent color.
                                                                                                                                                       // This makes the top-left quarter colored in the background color.
                                                                                                                                                       Rectangle rect = new Rectangle(0, 0, pngImage.Width / 2, pngImage.Height / 2);
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red), rect);

                                                                                                                                                       pngImage.Save();
                                                                                                                                                   }

HasTransparentColor

ให้มูลค่า boolean ที่แสดงให้เห็นว่าภาพมีโปร่งใสหรือไม่สี คุณสมบัตินี้เป็นสิ่งสําคัญสําหรับแอพพลิเคชันที่ต้องจัดการความโปร่งใสซึ่งช่วยให้ผู้พัฒนาสามารถตรวจสอบว่าการประมวลผลเพิ่มเติมเป็นต้องการจัดการพื้นที่โปร่งใสในภาพ

public override bool HasTransparentColor { get; set; }

คุณสมบัติมูลค่า

bool

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นวิธีการตั้งสีโปร่งใสอย่างสมบูรณ์สําหรับส่วนของภาพ TrueColor PNG ซึ่งไม่สนับสนุนช่องอัลฟา

Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                                                   createOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\transparent.png", false);
                                                                                                                                                   createOptions.ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.Truecolor;

                                                                                                                                                   // Create a TrueColor PNG image of 100x100 px.
                                                                                                                                                   using (Aspose.Imaging.Image image = Image.Create(createOptions, 100, 100))
                                                                                                                                                   {
                                                                                                                                                       Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;
                                                                                                                                                       Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);

                                                                                                                                                       // All red pixels will be considered as fully transparent.
                                                                                                                                                       pngImage.TransparentColor = Aspose.Imaging.Color.Red;
                                                                                                                                                       pngImage.HasTransparentColor = true;

                                                                                                                                                       // All transparent pixels will have a background color.
                                                                                                                                                       pngImage.BackgroundColor = Aspose.Imaging.Color.Green;
                                                                                                                                                       pngImage.HasBackgroundColor = true;

                                                                                                                                                       // Fill the entire image with white color.
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White), pngImage.Bounds);

                                                                                                                                                       // Fill the top-left quarter of the image with the transparent color.
                                                                                                                                                       // This makes the top-left quarter colored in the background color.
                                                                                                                                                       Rectangle rect = new Rectangle(0, 0, pngImage.Width / 2, pngImage.Height / 2);
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red), rect);

                                                                                                                                                       pngImage.Save();
                                                                                                                                                   }

Height

รับความสูงของภาพ คุณสมบัตินี้จะคืนขนาดแนวตั้งของภาพภาพที่ช่วยให้ผู้พัฒนาสามารถกําหนดขนาดของมันในพิกเซลขั้วแนวตั้ง

public override int Height { get; }

คุณสมบัติมูลค่า

int

HorizontalResolution

การแก้ไขหรือแก้ไขความละเอียดแนวนอนของภาพ คุณสมบัตินี้แสดงให้เห็นถึงจํานวนพิกเซลต่อ นิ้วตามแกนแนวนอนของการปรับความละเอียดนี้สามารถส่งผลกระทบต่อขนาดทางกายภาพของภาพเมื่อพิมพ์หรือแสดง

public override double HorizontalResolution { get; set; }

คุณสมบัติมูลค่า

double

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นวิธีการตั้งค่าความละเอียดแนวนอน/แนวตั้งของภาพ PNG

string dir = "c:\\temp\\";

                                                                                                using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                {
                                                                                                    Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;

                                                                                                    // Get horizontal and vertical resolution of the PngImage.
                                                                                                    double horizontalResolution = pngImage.HorizontalResolution;
                                                                                                    double verticalResolution = pngImage.VerticalResolution;
                                                                                                    System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
                                                                                                    System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);

                                                                                                    if (horizontalResolution != 96.0 || verticalResolution != 96.0)
                                                                                                    {
                                                                                                        // Use the SetResolution method for updating both resolution values in a single call.
                                                                                                        System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                        pngImage.SetResolution(96.0, 96.0);

                                                                                                        System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", pngImage.HorizontalResolution);
                                                                                                        System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", pngImage.VerticalResolution);
                                                                                                    }
                                                                                                }

Interlaced

หมายถึงค่า Boolean ซึ่งแสดงให้เห็นว่า Aspose.Imaging.FileFormats.Png.PngImage คือinterlaced ซึ่งกําหนดว่าข้อมูลภาพจะถูกเก็บไว้ในขั้นสูงวิธีสําหรับการชาร์จหรือถ่ายโอนเร็วขึ้น

public bool Interlaced { get; }

คุณสมบัติมูลค่า

bool

IsInterlaced

กลับค่า boolean ที่แสดงให้เห็นว่าตัวอย่างภาพจะถูกเชื่อมต่อคุณสมบัติเป็นสิ่งสําคัญในการเพิ่มประสิทธิภาพของกลยุทธ์การโหลดและให้แน่ใจว่ามีประสิทธิภาพประสิทธิภาพในการประมวลผลภาพหรืองานแสดงผล

public bool IsInterlaced { get; }

คุณสมบัติมูลค่า

bool

RawDataFormat

เข้าถึงรูปแบบข้อมูลวัตถุดิบของภาพ คุณสมบัตินี้ให้ความเห็นถึงวิธีการโครงสร้างข้อมูลภาพภายในซึ่งอาจเป็นประโยชน์สําหรับขั้นสูงการประมวลผลภาพงานหรือการแปลงรูปแบบ

public override PixelDataFormat RawDataFormat { get; }

คุณสมบัติมูลค่า

PixelDataFormat

Examples

ตัวอย่างต่อไปนี้โหลดภาพ PNG และพิมพ์ข้อมูลเกี่ยวกับรูปแบบข้อมูลดิบและช่องอัลฟา

// The PNG images to load.
                                                                                                                 string[] fileNames = new string[]
                                                                                                                 {
                                                                                                                     @"c:\temp\sample.png",
                                                                                                                     @"c:\temp\alpha.png",
                                                                                                                 };

                                                                                                                 foreach (string fileName in fileNames)
                                                                                                                 {
                                                                                                                     using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(fileName))
                                                                                                                     {
                                                                                                                         Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;
                                                                                                                         System.Console.WriteLine("ImageFile={0}, FileFormat={1}, HasAlpha={2}", fileName, pngImage.RawDataFormat, pngImage.HasAlpha);
                                                                                                                     }
                                                                                                                 }

                                                                                                                 // The output may look like this:
                                                                                                                 // ImageFile=c:\temp\sample.png, FileFormat=Rgb24Bpp, used channels: 8,8,8, HasAlpha=False
                                                                                                                 // ImageFile=c:\temp\alpha.png, FileFormat=RGBA32Bpp, used channels: 8,8,8,8, HasAlpha=True

TransparentColor

กลับสีโปร่งใสของภาพถ้ามี คุณสมบัตินี้คือค่าใช้จ่ายสําหรับแอพพลิเคชันที่จําเป็นต้องจัดการพื้นที่โปร่งใสอย่างแม่นยําภายในภาพให้ผู้พัฒนาสามารถเข้าถึงและจัดการกับภาพที่เฉพาะเจาะจงสีโปร่งใสที่ใช้

public override Color TransparentColor { get; set; }

คุณสมบัติมูลค่า

Color

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นวิธีการตั้งสีโปร่งใสอย่างสมบูรณ์สําหรับส่วนของภาพ TrueColor PNG ซึ่งไม่สนับสนุนช่องอัลฟา

Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                                                   createOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\transparent.png", false);
                                                                                                                                                   createOptions.ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.Truecolor;

                                                                                                                                                   // Create a TrueColor PNG image of 100x100 px.
                                                                                                                                                   using (Aspose.Imaging.Image image = Image.Create(createOptions, 100, 100))
                                                                                                                                                   {
                                                                                                                                                       Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;
                                                                                                                                                       Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);

                                                                                                                                                       // All red pixels will be considered as fully transparent.
                                                                                                                                                       pngImage.TransparentColor = Aspose.Imaging.Color.Red;
                                                                                                                                                       pngImage.HasTransparentColor = true;

                                                                                                                                                       // All transparent pixels will have a background color.
                                                                                                                                                       pngImage.BackgroundColor = Aspose.Imaging.Color.Green;
                                                                                                                                                       pngImage.HasBackgroundColor = true;

                                                                                                                                                       // Fill the entire image with white color.
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White), pngImage.Bounds);

                                                                                                                                                       // Fill the top-left quarter of the image with the transparent color.
                                                                                                                                                       // This makes the top-left quarter colored in the background color.
                                                                                                                                                       Rectangle rect = new Rectangle(0, 0, pngImage.Width / 2, pngImage.Height / 2);
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red), rect);

                                                                                                                                                       pngImage.Save();
                                                                                                                                                   }

VerticalResolution

ให้การเข้าถึงความละเอียดแนวตั้งของภาพ ผู้พัฒนาสามารถใช้คุณสมบัตินี้จะได้รับหรือแก้ไขการตั้งค่าการแก้ปัญหาซึ่งแสดงให้เห็นว่าจํานวนพิกเซลต่อ นิ้ว (PPI) ระยะทางแนวตั้งของภาพ

public override double VerticalResolution { get; set; }

คุณสมบัติมูลค่า

double

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นวิธีการตั้งค่าความละเอียดแนวนอน/แนวตั้งของภาพ PNG

string dir = "c:\\temp\\";

                                                                                                using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                {
                                                                                                    Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;

                                                                                                    // Get horizontal and vertical resolution of the PngImage.
                                                                                                    double horizontalResolution = pngImage.HorizontalResolution;
                                                                                                    double verticalResolution = pngImage.VerticalResolution;
                                                                                                    System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
                                                                                                    System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);

                                                                                                    if (horizontalResolution != 96.0 || verticalResolution != 96.0)
                                                                                                    {
                                                                                                        // Use the SetResolution method for updating both resolution values in a single call.
                                                                                                        System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                        pngImage.SetResolution(96.0, 96.0);

                                                                                                        System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", pngImage.HorizontalResolution);
                                                                                                        System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", pngImage.VerticalResolution);
                                                                                                    }
                                                                                                }

Width

อนุญาตให้ได้รับความกว้างของภาพให้ข้อมูลที่สําคัญเกี่ยวกับขนาดของมัน คุณสมบัตินี้ถูกใช้กันอย่างแพร่หลายโดยนักพัฒนาเพื่อกําหนดความกว้างของภาพช่วยให้พวกเขาสามารถดําเนินการต่างๆตามในขนาดของมัน

public override int Width { get; }

คุณสมบัติมูลค่า

int

XmpData

การเข้าถึงหรือแก้ไข metadata Platform Extensible (XMP) ที่เกี่ยวข้องด้วยภาพ คุณสมบัตินี้ช่วยให้การสกัดการเปลี่ยนแปลงหรือเพิ่มข้อมูลโลหะเพื่อให้สามารถจัดการข้อมูลที่เกี่ยวข้องกับภาพได้อย่างสมบูรณ์

public override XmpPacketWrapper XmpData { get; set; }

คุณสมบัติมูลค่า

XmpPacketWrapper

Methods

GetDefaultOptions(วัตถุ[])

รับตัวเลือกแบบ default

public override ImageOptionsBase GetDefaultOptions(object[] args)

Parameters

args object [ ]

ข้อตกลง

Returns

ImageOptionsBase

ตัวเลือกที่กําหนดเอง

GetModifyDate(บอล)

ระยะเวลาที่แสดงให้เห็นการเปลี่ยนแปลงล่าสุดของทรัพยากรรูปภาพ วิธีนี้ช่วยให้เข้าถึงข้อมูลโลหะที่สําคัญซึ่งช่วยให้การใช้งานตรวจสอบเมื่อภาพถูกเปลี่ยนแปลงครั้งสุดท้ายช่วยให้การติดตามรุ่นและการจัดการเนื้อหา

public override DateTime GetModifyDate(bool useDefault)

Parameters

useDefault bool

ถ้าตั้งค่าเป็น “จริง” ใช้ข้อมูลจาก FileInfo เป็นค่าเริ่มต้น

Returns

DateTime

วันที่และเวลาภาพทรัพยากรได้รับการแก้ไขครั้งสุดท้าย

GetOriginalOptions()

รับตัวเลือกตามการตั้งค่าไฟล์เดิมนี่อาจเป็นประโยชน์ในการรักษาความลึกและพารามิเตอร์อื่น ๆ ของภาพเดิมไม่เปลี่ยนแปลงตัวอย่างเช่นถ้าเราโหลดภาพ PNG สีดําและสีขาวด้วย 1 บิตต่อพิกเซลแล้วบันทึกมันโดยใช้Aspose.Imaging.DataStreamSupporter.Save(System.String) วิธีการภาพ PNG output กับ 8 บิตต่อพิกเซลจะผลิตเพื่อหลีกเลี่ยงและบันทึกภาพ PNG ด้วย 1 บิตต่อพิกเซลใช้วิธีการนี้เพื่อรับตัวเลือกการบันทึกที่เหมาะสมและผ่านพวกเขาวิธีการ Aspose.Imaging.Image.Save(System.String,Aspose.Imaging.ImageOptionsBase) เป็นพารามิเตอร์ที่สอง

public override ImageOptionsBase GetOriginalOptions()

Returns

ImageOptionsBase

ตัวเลือกตามการตั้งค่าไฟล์เดิม

OnPaletteChanged(IColorPalette, IColorPalette)

โทรเมื่อแพลตฟอร์มมีการเปลี่ยนแปลง

protected override void OnPaletteChanged(IColorPalette oldPalette, IColorPalette newPalette)

Parameters

oldPalette IColorPalette

แพลิเคชันเก่า

newPalette IColorPalette

แพลิเคชันใหม่

SaveData(Stream)

การบันทึกข้อมูล

protected override void SaveData(Stream stream)

Parameters

stream Stream

กระแส

UpdateDimensions(int, int)

ขนาดการปรับปรุง

protected override void UpdateDimensions(int newWidth, int newHeight)

Parameters

newWidth int

ความกว้างใหม่

newHeight int

ความสูงใหม่

UpdateMetadata()

ปรับปรุงภาพวันที่และเวลาการเปลี่ยนแปลงครั้งสุดท้าย

protected override void UpdateMetadata()
 แบบไทย