Class WebPImage

Class WebPImage

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

Manipulate WebP raster images with our API, ใช้คุณสมบัติที่ทันสมัยสําหรับทั้งสองการบีบอัดไม่มีการสูญเสียและไม่มีการสูญเสียเพื่อให้แน่ใจว่าคุณภาพภาพที่ดีที่สุดด้วยขนาดไฟล์ที่ลดลงการจัดการรูปแบบไฟล์ขยาย animations และช่องอัลฟาได้อย่างง่ายดายอัปเดตขนาดการรีไซเคิลอย่าง proportionally, การขุด, การหมุน, การใช้กรอง,การปรับพารามิเตอร์ภาพและแปลงเป็นรูปแบบภาพอื่น ๆ เพื่อความหลากหลายการเพิ่มประสิทธิภาพภาพเว็บไซต์

[JsonObject(MemberSerialization.OptIn)]
public sealed class WebPImage : RasterCachedMultipageImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata, IMultipageImageExt, IMultipageImage

Inheritance

object DisposableObject DataStreamSupporter Image RasterImage RasterCachedImage RasterCachedMultipageImage WebPImage

Implements

IDisposable , IObjectWithBounds , IRasterImageArgb32PixelLoader , IRasterImageRawDataLoader , IHasXmpData , IHasMetadata , IMultipageImageExt , IMultipageImage

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

RasterCachedMultipageImage.AdjustBrightness(int) , RasterCachedMultipageImage.AdjustContrast(float) , RasterCachedMultipageImage.AdjustGamma(float, float, float) , RasterCachedMultipageImage.AdjustGamma(float) , RasterCachedMultipageImage.Blend(Point, RasterImage, Rectangle, byte) , RasterCachedMultipageImage.BinarizeFixed(byte) , RasterCachedMultipageImage.BinarizeBradley(double, int) , RasterCachedMultipageImage.BinarizeBradley(double) , RasterCachedMultipageImage.BinarizeOtsu() , RasterCachedMultipageImage.Crop(Rectangle) , RasterCachedMultipageImage.Crop(int, int, int, int) , RasterCachedMultipageImage.Dither(DitheringMethod, int, IColorPalette) , RasterCachedMultipageImage.Grayscale() , RasterCachedMultipageImage.NormalizeHistogram() , RasterCachedMultipageImage.Rotate(float, bool, Color) , RasterCachedMultipageImage.RotateFlip(RotateFlipType) , RasterCachedMultipageImage.RotateFlipAll(RotateFlipType) , RasterCachedMultipageImage.Resize(int, int, ResizeType) , RasterCachedMultipageImage.Resize(int, int, ImageResizeSettings) , RasterCachedMultipageImage.ResizeWidthProportionally(int, ResizeType) , RasterCachedMultipageImage.ResizeHeightProportionally(int, ResizeType) , RasterCachedMultipageImage.ReplaceColor(int, byte, int) , RasterCachedMultipageImage.ReplaceNonTransparentColors(int) , RasterCachedMultipageImage.Filter(Rectangle, FilterOptionsBase) , RasterCachedMultipageImage.NormalizeAngle(bool, Color) , RasterCachedMultipageImage.CacheData() , RasterCachedMultipageImage.GetSerializedStream(ImageOptionsBase, Rectangle, out int) , RasterCachedMultipageImage.Height , RasterCachedMultipageImage.Width , RasterCachedMultipageImage.BitsPerPixel , RasterCachedMultipageImage.IsCached , RasterCachedMultipageImage.PageCount , RasterCachedMultipageImage.Pages , RasterCachedMultipageImage.HasAlpha , RasterCachedMultipageImage.HasTransparentColor , RasterCachedMultipageImage.ImageOpacity , RasterCachedMultipageImage.BackgroundColor , RasterCachedMultipageImage.XmpData , RasterCachedMultipageImage.PageExportingAction , 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.IsCached , 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.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 , 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.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.CacheData() , DataStreamSupporter.Save() , DataStreamSupporter.Save(Stream) , DataStreamSupporter.Save(string) , DataStreamSupporter.Save(string, bool) , DataStreamSupporter.DataStreamContainer , DataStreamSupporter.IsCached , DisposableObject.Dispose() , DisposableObject.Disposed , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

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

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

                                                                                      // Load a WebP image from a file.
                                                                                      using (Aspose.Imaging.FileFormats.Webp.WebPImage webPImage = new Aspose.Imaging.FileFormats.Webp.WebPImage(dir + "test.webp"))
                                                                                      {
                                                                                          // Save to PNG
                                                                                          // Note that only the active frame will be stored to PNG, since PNG is not a multi-page format.
                                                                                          webPImage.Save(dir + "test.output.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                      }

Constructors

เว็บแคม(Stream)

คลาส Aspose.Imaging.FileFormats.Webp.WebPImage คลาส Aspose.Imaging.FileFormats.WebPimage คลาส Aspose.Imaging.FileFormats.Webp.WebPimage คลาส Aspose.Imaging.WebPimage คลาส Aspose.Imaging.WebPimage คลาส Aspose.WebPimage คลาส Aspose.WebPimage คลาส Aspose.WebPimage คลาส Aspose.จากแหล่งการไหลที่ให้ ใช้ผู้สร้างนี้เพื่อสร้าง WebP ได้อย่างง่ายดายวัตถุภาพโดยตรงจากการไหลช่วยให้การจัดการและการจัดการได้อย่างมีประสิทธิภาพข้อมูลภาพ WebP ในแอพพลิเคชันของคุณ

public WebPImage(Stream stream)

Parameters

stream Stream

กระแส WebP รูปภาพ

Examples

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

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

                                                                                             // Load a WebP image from a file stream.
                                                                                             using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "test.webp"))
                                                                                             using (Aspose.Imaging.FileFormats.Webp.WebPImage webPImage = new Aspose.Imaging.FileFormats.Webp.WebPImage(stream))
                                                                                             {
                                                                                                 // Save to PNG
                                                                                                 // Note that only the active frame will be stored to PNG, since PNG is not a multi-page format.
                                                                                                 webPImage.Save(dir + "test.output.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                             }

เว็บแคม(แหล่งจ่ายไฟ LoadOptions)

สร้างตัวอย่างใหม่ของคลาส Aspose.Imaging.FileFormats.Webp.WebPImage โดยใช้การไหลและตัวเลือกโหลดที่กําหนดช่วยให้การจัดการข้อมูลภาพ WebP มีความหลากหลายรวมตัวสร้างนี้เพื่อเริ่มต้นวัตถุภาพ WebP จากกระแสในขณะที่กําหนดค่าพารามิเตอร์โหลดตามที่จําเป็นภายในแอพของคุณ

public WebPImage(Stream stream, LoadOptions loadOptions)

Parameters

stream Stream

กระแส WebP รูปภาพ

loadOptions LoadOptions

ตัวเลือกโหลด

เว็บแคม(รั้ว)

Instantiate ตัวอย่างใหม่ของ Aspose.Imaging.FileFormats.Webp.WebPImage class, initializedจากแหล่งไฟล์ที่มาใช้ ใช้ผู้สร้างนี้เพื่อสร้าง WebP ได้อย่างง่ายดายภาพวัตถุโดยตรงจากไฟล์ทําให้กระบวนการโหลดและการจัดการข้อมูลภาพ WebP ในแอพของคุณ

public WebPImage(string path)

Parameters

path string

วิธีที่จะไฟล์ WebP Image

Examples

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

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

                                                                                      // Load a WebP image from a file.
                                                                                      using (Aspose.Imaging.FileFormats.Webp.WebPImage webPImage = new Aspose.Imaging.FileFormats.Webp.WebPImage(dir + "test.webp"))
                                                                                      {
                                                                                          // Save to PNG
                                                                                          // Note that only the active frame will be stored to PNG, since PNG is not a multi-page format.
                                                                                          webPImage.Save(dir + "test.output.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                      }

เว็บแคม(ลวด, LoadOptions)

สร้างตัวอย่างใหม่ของคลาส Aspose.Imaging.FileFormats.Webp.WebPImage โดยใช้ไฟล์และตัวเลือกโหลดที่กําหนดช่วยให้การจัดการข้อมูลภาพ WebP มีความยืดหยุ่นโครงสร้างนี้จะเริ่มต้นวัตถุภาพ WebP จากไฟล์ในขณะที่กําหนดค่าพารามิเตอร์โหลดตามความต้องการของแอพของคุณ

public WebPImage(string path, LoadOptions loadOptions)

Parameters

path string

วิธีที่จะไฟล์ WebP Image

loadOptions LoadOptions

ตัวเลือกโหลด

เว็บแคม(RasterImage)

คลาส Aspose.Imaging.FileFormats.Webp.WebPImage คลาส Aspose.Imaging.FileFormats.WebPimage คลาส Aspose.Imaging.FileFormats.Webp.WebPimage คลาส Aspose.Imaging.WebPimage คลาส Aspose.Imaging.WebPimage คลาส Aspose.WebPimage คลาส Aspose.WebPimage คลาส Aspose.WebPimage คลาส Aspose.จากวัตถุที่ให้ rasterImage ผู้ก่อสร้างนี้อนุญาตให้การแปลงภาพสกรูไปยังรูปแบบ WebP ช่วยให้การจัดการที่มีประสิทธิภาพและการจัดการข้อมูลภาพภายในแอพลิเคชันของคุณ

public WebPImage(RasterImage rasterImage)

Parameters

rasterImage RasterImage

รูปภาพสกรู

Examples

ตัวอย่างนี้แสดงให้เห็นวิธีการสร้างภาพ WebP จากภาพ raster อื่น ๆ

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

                                                                                   // Load a PNG image of 100x100 px.
                                                                                   using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100))
                                                                                   {
                                                                                       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(pngImage);

                                                                                       // Fill the entire image in red.
                                                                                       Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                       graphics.FillRectangle(brush, pngImage.Bounds);

                                                                                       // Create a WebP image based on the PNG image.
                                                                                       using (Aspose.Imaging.FileFormats.Webp.WebPImage webPImage = new Aspose.Imaging.FileFormats.Webp.WebPImage(pngImage))
                                                                                       {
                                                                                           // Save to a WebP file with default options
                                                                                           webPImage.Save(dir + "output.webp", new Aspose.Imaging.ImageOptions.WebPOptions());
                                                                                       }
                                                                                   }

เว็บแคม(RasterImage, LoadOptions)

สร้างตัวอย่างใหม่ของคลาส Aspose.Imaging.FileFormats.Webp.WebPImage โดยใช้วัตถุ rasterImage และตัวเลือกโหลดที่ระบุซึ่งช่วยให้การจัดการข้อมูลภาพมีความยืดหยุ่น ใช้ข้อมูลนี้ผู้ก่อสร้างที่จะเปิดตัววัตถุภาพ WebP จากภาพ raster ในขณะที่กําหนดค่าพารามิเตอร์โหลดตามความต้องการของแอพของคุณ

public WebPImage(RasterImage rasterImage, LoadOptions loadOptions)

Parameters

rasterImage RasterImage

รูปภาพสกรู

loadOptions LoadOptions

ตัวเลือกโหลด

เว็บแคม(int, int, WebPOptions)

Instant a new instance of the Aspose.Imaging.FileFormats.Webp.WebPImage class with an emptyภาพของความกว้างและความสูงที่ระบุ ตัวสร้างนี้อนุญาตให้การสร้างภาพ WebP สีขาวให้พื้นฐานสําหรับภาพต่อไปนี้การจัดการและการสร้างเนื้อหาภายในแอพลิเคชันของคุณ

public WebPImage(int width, int height, WebPOptions options)

Parameters

width int

ความกว้างของภาพ

height int

ความสูงของภาพ

options WebPOptions

ตัวเลือก

Examples

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

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

                                                                                                 Aspose.Imaging.ImageOptions.WebPOptions createOptions = new Aspose.Imaging.ImageOptions.WebPOptions();
                                                                                                 createOptions.Lossless = true;
                                                                                                 createOptions.Quality = 100f;
                                                                                                 //createOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(dir + "output.webp");

                                                                                                 // Create a WebP image of 100x100 px.
                                                                                                 using (Aspose.Imaging.FileFormats.Webp.WebPImage webPImage = new Aspose.Imaging.FileFormats.Webp.WebPImage(100, 100, createOptions))
                                                                                                 {
                                                                                                     Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(webPImage);

                                                                                                     // Fill the entire image in red.
                                                                                                     Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                                     graphics.FillRectangle(brush, webPImage.Bounds);

                                                                                                     // Save to a WebP file
                                                                                                     webPImage.Save(dir + "output.webp");
                                                                                                 }

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

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

                                                                                                         Aspose.Imaging.ImageOptions.WebPOptions createOptions = new Aspose.Imaging.ImageOptions.WebPOptions();
                                                                                                         createOptions.Lossless = true;
                                                                                                         createOptions.Quality = 100f;
                                                                                                         createOptions.AnimBackgroundColor = (uint)Aspose.Imaging.Color.Gray.ToArgb();

                                                                                                         // The default frame plus 36 + 36 additional frames.
                                                                                                         createOptions.AnimLoopCount = 36 + 36 + 1;

                                                                                                         // Create a WebP image of 100x100 px.
                                                                                                         using (Aspose.Imaging.FileFormats.Webp.WebPImage webPImage = new Aspose.Imaging.FileFormats.Webp.WebPImage(100, 100, createOptions))
                                                                                                         {
                                                                                                             // The first circle is red
                                                                                                             Aspose.Imaging.Brushes.SolidBrush brush1 = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);

                                                                                                             // The second circle is black
                                                                                                             Aspose.Imaging.Brushes.SolidBrush brush2 = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Black);

                                                                                                             // Gradually inscrease the angle of the red arc shape.
                                                                                                             for (int angle = 10; angle <= 360; angle += 10)
                                                                                                             {
                                                                                                                 Aspose.Imaging.FileFormats.Webp.WebPFrameBlock block = new Aspose.Imaging.FileFormats.Webp.WebPFrameBlock(100, 100);
                                                                                                                 Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(block);
                                                                                                                 graphics.FillPie(brush1, block.Bounds, 0, angle);

                                                                                                                 webPImage.AddBlock(block);
                                                                                                             }

                                                                                                             // Gradually inscrease the angle of the black arc and wipe out the red arc.
                                                                                                             for (int angle = 10; angle <= 360; angle += 10)
                                                                                                             {
                                                                                                                 Aspose.Imaging.FileFormats.Webp.WebPFrameBlock block = new Aspose.Imaging.FileFormats.Webp.WebPFrameBlock(100, 100);

                                                                                                                 Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(block);
                                                                                                                 graphics.FillPie(brush2, block.Bounds, 0, angle);
                                                                                                                 graphics.FillPie(brush1, block.Bounds, angle, 360 - angle);

                                                                                                                 webPImage.AddBlock(block);
                                                                                                             }

                                                                                                             // Save to a WebP file
                                                                                                             webPImage.Save(dir + "output.webp");
                                                                                                         }

เว็บแคม(int, int, WebPOptions, LoadOptions)

สร้างตัวอย่างใหม่ของคลาส Aspose.Imaging.FileFormats.Webp.WebPImage ด้วยภาพว่างเปล่าและระบุตัวเลือกโหลด ผู้สร้างนี้ช่วยให้การเริ่มต้นของภาพ WebP กับพารามิเตอร์โหลดที่กําหนดเองให้ความยืดหยุ่นในการสร้างภาพและการจัดการภายในแอพลิเคชันของคุณ

public WebPImage(int width, int height, WebPOptions options, LoadOptions loadOptions)

Parameters

width int

ความกว้างของภาพ

height int

ความสูงของภาพ

options WebPOptions

ตัวเลือก

loadOptions LoadOptions

ตัวเลือกโหลด

Properties

FileFormat

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

public override FileFormat FileFormat { get; }

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

FileFormat

HasAlpha

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

public override bool HasAlpha { get; }

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

bool

Examples

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

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

                                                                                                                   string fileName = dir + "sample.webp";
                                                                                                                   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(fileName))
                                                                                                                   {
                                                                                                                       Aspose.Imaging.FileFormats.Webp.WebPImage webpImage = (Aspose.Imaging.FileFormats.Webp.WebPImage)image;

                                                                                                                       // If the active TIFF frame has alpha channel, then the entire TIFF image is considered to have alpha channel.
                                                                                                                       System.Console.WriteLine("ImageFile={0}, FileFormat={1}, HasAlpha={2}", fileName, webpImage.RawDataFormat, webpImage.HasAlpha);

                                                                                                                       int i = 0;
                                                                                                                       foreach (Aspose.Imaging.FileFormats.Webp.IFrame frame in webpImage.Blocks)
                                                                                                                       {
                                                                                                                           Aspose.Imaging.FileFormats.Webp.WebPFrameBlock frameBlock = frame as Aspose.Imaging.FileFormats.Webp.WebPFrameBlock;
                                                                                                                           if (frameBlock != null)
                                                                                                                           {
                                                                                                                               System.Console.WriteLine("Frame={0}, FileFormat={1}, HasAlpha={2}", i++, frameBlock.RawDataFormat, frameBlock.HasAlpha);
                                                                                                                           }
                                                                                                                       }
                                                                                                                   }

                                                                                                                   // The output may look like this:
                                                                                                                   // ImageFile=c:\temp\sample.webp, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False
                                                                                                                   // Frame=0, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False

Options

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

[JsonProperty]
public WebPOptions Options { get; }

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

WebPOptions

PageCount

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

public override int PageCount { get; }

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

int

Pages

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

public override Image[] Pages { get; }

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

Image [ ]

Methods

AddBlock(IFRAM)

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

public void AddBlock(IFrame block)

Parameters

block IFrame

Webp บล็อกเพื่อเพิ่ม

Examples

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

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

                                                                                                         Aspose.Imaging.ImageOptions.WebPOptions createOptions = new Aspose.Imaging.ImageOptions.WebPOptions();
                                                                                                         createOptions.Lossless = true;
                                                                                                         createOptions.Quality = 100f;
                                                                                                         createOptions.AnimBackgroundColor = (uint)Aspose.Imaging.Color.Gray.ToArgb();

                                                                                                         // The default frame plus 36 + 36 additional frames.
                                                                                                         createOptions.AnimLoopCount = 36 + 36 + 1;

                                                                                                         // Create a WebP image of 100x100 px.
                                                                                                         using (Aspose.Imaging.FileFormats.Webp.WebPImage webPImage = new Aspose.Imaging.FileFormats.Webp.WebPImage(100, 100, createOptions))
                                                                                                         {
                                                                                                             // The first circle is red
                                                                                                             Aspose.Imaging.Brushes.SolidBrush brush1 = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);

                                                                                                             // The second circle is black
                                                                                                             Aspose.Imaging.Brushes.SolidBrush brush2 = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Black);

                                                                                                             // Gradually inscrease the angle of the red arc shape.
                                                                                                             for (int angle = 10; angle <= 360; angle += 10)
                                                                                                             {
                                                                                                                 Aspose.Imaging.FileFormats.Webp.WebPFrameBlock block = new Aspose.Imaging.FileFormats.Webp.WebPFrameBlock(100, 100);
                                                                                                                 Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(block);
                                                                                                                 graphics.FillPie(brush1, block.Bounds, 0, angle);

                                                                                                                 webPImage.AddBlock(block);
                                                                                                             }

                                                                                                             // Gradually inscrease the angle of the black arc and wipe out the red arc.
                                                                                                             for (int angle = 10; angle <= 360; angle += 10)
                                                                                                             {
                                                                                                                 Aspose.Imaging.FileFormats.Webp.WebPFrameBlock block = new Aspose.Imaging.FileFormats.Webp.WebPFrameBlock(100, 100);

                                                                                                                 Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(block);
                                                                                                                 graphics.FillPie(brush2, block.Bounds, 0, angle);
                                                                                                                 graphics.FillPie(brush1, block.Bounds, angle, 360 - angle);

                                                                                                                 webPImage.AddBlock(block);
                                                                                                             }

                                                                                                             // Save to a WebP file
                                                                                                             webPImage.Save(dir + "output.webp");
                                                                                                         }

AddPage(RasterImage)

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

public void AddPage(RasterImage page)

Parameters

page RasterImage

หน้าที่เพิ่ม

Exceptions

ArgumentNullException

page’ is null.

AdjustBrightness(int)

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

public override void AdjustBrightness(int brightness)

Parameters

brightness int

ความสว่าง

AdjustContrast(เฟอร์รี่)

เพิ่มความต้านทานของ Aspose.Imaging.Image, เพิ่มความต้านทานความแตกต่างระหว่างพื้นที่แสงและสีดํา รวมวิธีการนี้ในภาพของคุณการประมวลผลการทํางานเพื่อปรับปรุงความชัดเจนภาพและคุณภาพภาพรวมภายในการสมัครของคุณ

public override void AdjustContrast(float contrast)

Parameters

contrast float

คะแนนความต้านทาน (ในช่วง [-100; 100])

AdjustGamma(เฟอร์รี่)

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

public override void AdjustGamma(float gamma)

Parameters

gamma float

GAMMA สําหรับช่องแดงสีเขียวและสีน้ําเงิน

AdjustGamma(เฟอร์รี่, เฟอร์รี่, เฟอร์รี่)

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

public override void AdjustGamma(float gammaRed, float gammaGreen, float gammaBlue)

Parameters

gammaRed float

Gamma สําหรับช่องแดง Coefficient

gammaGreen float

Gamma สําหรับ Coefficient ช่องสีเขียว

gammaBlue float

Gamma สําหรับ Coefficient ช่องสีฟ้า

BinarizeBradley(สอง, int)

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

public override void BinarizeBradley(double brightnessDifference, int windowSize)

Parameters

brightnessDifference double

ความแตกต่างของความสว่างระหว่างพิกเซลและเฉลี่ยของหน้าต่าง s x s ของพิกเซลมุ่งเน้นรอบพิกเซลนี้

windowSize int

ขนาดหน้าต่าง s x s ของพิกเซลที่มุ่งเน้นรอบพิกเซลนี้

BinarizeFixed(บิต)

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

public override void BinarizeFixed(byte threshold)

Parameters

threshold byte

หมายเลขหมายเลขหมายเลขหมายเลขหมายเลขหมายเลขหมายเลขหมายเลขหมายเลขหมายเลขหมายเลขหมายเลข255 จะถูกกําหนดไว้กับมัน 0 อื่น ๆ

BinarizeOtsu()

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

public override void BinarizeOtsu()

ClearBlocks()

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

public void ClearBlocks()

Crop(Rectangle)

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

public override void Crop(Rectangle rectangle)

Parameters

rectangle Rectangle

ตุ๊กตา

Crop(int, int, int, int)

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

public override void Crop(int leftShift, int rightShift, int topShift, int bottomShift)

Parameters

leftShift int

เปลี่ยนด้านซ้าย

rightShift int

เปลี่ยนที่เหมาะสม

topShift int

เปลี่ยนด้านบน

bottomShift int

เปลี่ยนด้านล่าง

Dither(DitheringMethod, int, IColorPalette)

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

public override void Dither(DitheringMethod ditheringMethod, int bitsCount, IColorPalette customPalette)

Parameters

ditheringMethod DitheringMethod

วิธีการไดร์เวอร์

bitsCount int

บิตสุดท้ายคํานวณสําหรับ dithering

customPalette IColorPalette

แพลิเคชันที่กําหนดเองสําหรับ dithering

Filter(Rectangle, FilterOptionsBase)

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

public override void Filter(Rectangle rectangle, FilterOptionsBase options)

Parameters

rectangle Rectangle

ตุ๊กตา

options FilterOptionsBase

ตัวเลือก

Examples

ตัวอย่างต่อไปนี้ใช้ประเภทต่างๆของกรองสําหรับภาพ WEBP

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

                                                                                  using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.webp"))
                                                                                  {
                                                                                      Aspose.Imaging.FileFormats.Webp.WebPImage webpImage = (Aspose.Imaging.FileFormats.Webp.WebPImage)image;

                                                                                      // Apply a median filter with a rectangle size of 5 to the entire image.
                                                                                      webpImage.Filter(webpImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.MedianFilterOptions(5));
                                                                                      webpImage.Save(dir + "sample.MedianFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                  }

                                                                                  using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.webp"))
                                                                                  {
                                                                                      Aspose.Imaging.FileFormats.Webp.WebPImage webpImage = (Aspose.Imaging.FileFormats.Webp.WebPImage)image;

                                                                                      // Apply a bilateral smoothing filter with a kernel size of 5 to the entire image.
                                                                                      webpImage.Filter(webpImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.BilateralSmoothingFilterOptions(5));
                                                                                      webpImage.Save(dir + "sample.BilateralSmoothingFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                  }

                                                                                  using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.webp"))
                                                                                  {
                                                                                      Aspose.Imaging.FileFormats.Webp.WebPImage webpImage = (Aspose.Imaging.FileFormats.Webp.WebPImage)image;

                                                                                      // Apply a Gaussian blur filter with a radius of 5 and a sigma value of 4.0 to the entire image.
                                                                                      webpImage.Filter(webpImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.GaussianBlurFilterOptions(5, 4.0));
                                                                                      webpImage.Save(dir + "sample.GaussianBlurFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                  }

                                                                                  using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.webp"))
                                                                                  {
                                                                                      Aspose.Imaging.FileFormats.Webp.WebPImage webpImage = (Aspose.Imaging.FileFormats.Webp.WebPImage)image;

                                                                                      // Apply a Gauss-Wiener filter with a radius of 5 and a smooth value of 4.0 to the entire image.
                                                                                      webpImage.Filter(webpImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.GaussWienerFilterOptions(5, 4.0));
                                                                                      webpImage.Save(dir + "sample.GaussWienerFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                  }

                                                                                  using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.webp"))
                                                                                  {
                                                                                      Aspose.Imaging.FileFormats.Webp.WebPImage webpImage = (Aspose.Imaging.FileFormats.Webp.WebPImage)image;

                                                                                      // Apply a motion wiener filter with a length of 5, a smooth value of 4.0 and an angle of 90.0 degrees to the entire image.
                                                                                      webpImage.Filter(webpImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.MotionWienerFilterOptions(10, 1.0, 90.0));
                                                                                      webpImage.Save(dir + "sample.MotionWienerFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                  }

                                                                                  using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.webp"))
                                                                                  {
                                                                                      Aspose.Imaging.FileFormats.Webp.WebPImage webpImage = (Aspose.Imaging.FileFormats.Webp.WebPImage)image;

                                                                                      // Apply a sharpen filter with a kernel size of 5 and a sigma value of 4.0 to the entire image.
                                                                                      webpImage.Filter(webpImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.SharpenFilterOptions(5, 4.0));
                                                                                      webpImage.Save(dir + "sample.SharpenFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                  }

Grayscale()

แปลงภาพไปสู่การแสดงผลสีเทาของมัน แปลงมันไปสู่การแสดงผลรูปแบบช่องเดียวที่แต่ละพิกเซลแสดงความเข้มหรือความสว่างวิธีการนี้เข้าไปในท่อประมวลผลภาพของคุณเพื่อให้การวิเคราะห์ที่เรียบง่ายและปรับปรุงความเข้ากันได้กับแอลกอริทึมบนพื้นฐานของ grayscale ช่วยให้เครื่องคอมพิวเตอร์ต่าง ๆงานวิเคราะห์ภาพและภาพภายในแอพพลิเคชันของคุณ

public override void Grayscale()

InsertBlock(int, iFrame)

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

public void InsertBlock(int index, IFrame block)

Parameters

index int

องค์ประกอบที่ขึ้นอยู่กับศูนย์ซึ่ง block" จะถูกแทรก

block IFrame

Webp บล็อกเพื่อเพิ่ม

ReleaseManagedResources()

เปิดตัวทรัพยากรที่จัดการ ตรวจสอบให้แน่ใจว่าไม่มีทรัพยากรที่ไม่ได้จัดการจะเปิดตัวที่นี่เพราะพวกเขาอาจมีอิสระแล้ว

protected override void ReleaseManagedResources()

RemoveBlock(IFRAM)

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

public void RemoveBlock(IFrame block)

Parameters

block IFrame

บล็อกที่จะลบ

Remarks

หมายเหตุ: อย่าลืมจัดตั้ง block" หากคุณไม่ต้องการเพิ่มมันไปยัง WebPImage อื่น ๆ

Resize(int, int, resizeType)

รีไซเคิลภาพปรับขนาดของมันในขณะที่รักษาความสัมพันธ์ด้านintegre this method into your image processing workflow to dynamically scaleภาพเพื่อตอบสนองความต้องการการแสดงผลหรือการจัดเก็บข้อมูลต่างๆภายในแอพของคุณ

public override void Resize(int newWidth, int newHeight, ResizeType resizeType)

Parameters

newWidth int

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

newHeight int

ความสูงใหม่

resizeType ResizeType

ประเภทการรีไซเคิล

Examples

ตัวอย่างนี้โหลดภาพ WEBP และรีไซเคิลมันโดยใช้วิธีการรีไซเคิลต่างๆ

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

                                                                                         using (Aspose.Imaging.FileFormats.Webp.WebPImage image = (Aspose.Imaging.FileFormats.Webp.WebPImage)Aspose.Imaging.Image.Load(dir + "sample.webp"))
                                                                                         {
                                                                                             // Scale up by 2 times using Nearest Neighbour resampling.
                                                                                             image.Resize(image.Width* 2, image.Height* 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);

                                                                                             // Save to PNG with default options.
                                                                                             image.Save(dir + "upsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                         }

                                                                                         using (Aspose.Imaging.FileFormats.Webp.WebPImage image = (Aspose.Imaging.FileFormats.Webp.WebPImage)Aspose.Imaging.Image.Load(dir + "sample.webp"))
                                                                                         {
                                                                                             // Scale down by 2 times using Nearest Neighbour resampling.
                                                                                             image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);

                                                                                             // Save to PNG with default options.
                                                                                             image.Save(dir + "downsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                         }

                                                                                         using (Aspose.Imaging.FileFormats.Webp.WebPImage image = (Aspose.Imaging.FileFormats.Webp.WebPImage)Aspose.Imaging.Image.Load(dir + "sample.webp"))
                                                                                         {
                                                                                             // Scale up by 2 times using Bilinear resampling.
                                                                                             image.Resize(image.Width* 2, image.Height* 2, Aspose.Imaging.ResizeType.BilinearResample);

                                                                                             // Save to PNG with default options.
                                                                                             image.Save(dir + "upsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                         }

                                                                                         using (Aspose.Imaging.FileFormats.Webp.WebPImage image = (Aspose.Imaging.FileFormats.Webp.WebPImage)Aspose.Imaging.Image.Load(dir + "sample.webp"))
                                                                                         {
                                                                                             // Scale down by 2 times using Bilinear resampling.
                                                                                             image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.BilinearResample);

                                                                                             // Save to PNG with default options.
                                                                                             image.Save(dir + "downsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                         }

Resize(int, int, ImageResizeSettings)

การรีไซเคิลภาพตามการตั้งค่าที่กําหนดให้การควบคุมที่แม่นยําdimensions, aspect ratio, และพฤติกรรมการสแกน การรวมวิธีการนี้ into yourการประมวลผลภาพกระแสการทํางานเพื่อให้ดําเนินการรีไซเคิลที่กําหนดเองที่กําหนดเองข้อกําหนดเฉพาะของใบสมัครของคุณ

public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)

Parameters

newWidth int

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

newHeight int

ความสูงใหม่

settings ImageResizeSettings

การตั้งค่ารีไซเคิล

ResizeHeightProportionally(int, ResizeType)

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

public override void ResizeHeightProportionally(int newHeight, ResizeType resizeType)

Parameters

newHeight int

ความสูงใหม่

resizeType ResizeType

ประเภทของ Resize

ResizeWidthProportionally(int, ResizeType)

อัตราส่วนปรับความกว้างของภาพในขณะที่รักษาความสัมพันธ์ด้านของภาพintegre this method into your image processing workflow เพื่อรีไซเคิลแบบไดนามิกภาพที่มีความสัมพันธ์ที่สม่ําเสมอเพื่อให้แน่ใจว่าการแสดงผลหรือการจัดเก็บที่เหมาะสมภายในการสมัครของคุณ

public override void ResizeWidthProportionally(int newWidth, ResizeType resizeType)

Parameters

newWidth int

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

resizeType ResizeType

ประเภทของ Resize

Rotate(บอล, บอล, สี)

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

public override void Rotate(float angle, bool resizeProportionally, Color backgroundColor)

Parameters

angle float

มุมหมุนในเกรด หมายเลขเชิงบวกจะหมุนตามชั่วโมง

resizeProportionally bool

ถ้าตั้งค่าเป็น “จริง” คุณจะมีการเปลี่ยนแปลงขนาดภาพของคุณตามแนวตั้งหมุน (จุดมุม) projections ในกรณีอื่น ๆ ที่ปล่อยให้มิติไม่สัมผัสและเพียงภายใน เนื้อหาภาพจะหมุน

backgroundColor Color

สีของพื้นหลัง

RotateFlip(RotateFlipType)

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

public override void RotateFlip(RotateFlipType rotateFlipType)

Parameters

rotateFlipType RotateFlipType

ประเภทหมุน flip

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

ความสูงของภาพใหม่

 แบบไทย