Class GifImage
اسم الفضاء : Aspose.Imaging.FileFormats.Gif تجميع: Aspose.Imaging.dll (25.4.0)
يتوفر ملف الصورة لـ API for Graphical Interchange Format (GIF)المطورين مع أدوات متنوعة لمعالجة الصور المضغوطة وGIFs الرسوم المتحركة. يقدم ميزات مثل XMP المعالجة البيانات الميتا، لوحة الألوانالإعدادات، الخلفية والسيطرة الشفافة على الألوان، إعدادات اللامبالاة، إعادة القياس،زراعة, تطبيق الفلتر, تصحيح غاما, تعديل التباين, grayscaleالتحويل، وتحويلها إلى تنسيقات أخرى.هذا API يتيحالتلاعب وتحسين صور GIF لمجموعة واسعة من التطبيقات.
[JsonObject(MemberSerialization.OptIn)]
public sealed class GifImage : RasterCachedMultipageImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata, IMultipageImageExt, IMultipageImage
Inheritance
object ← DisposableObject ← DataStreamSupporter ← Image ← RasterImage ← RasterCachedImage ← RasterCachedMultipageImage ← GifImage
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
تصدير جزء من الرسوم المتحركة من صورة GIF استنادا إلى فترات زمنية.
using (var image = Image.Load("Animation.gif"))
{
var options = new GifOptions
{
FullFrame = true,
MultiPageOptions = new MultiPageOptions
{
Mode = MultiPageMode.TimeInterval,
TimeInterval = new TimeInterval(0, 400)
}
};
image.Save("PartOfAnimation.gif", options);
}
هذا المثال يظهر كيفية إنشاء صورة GIF وتخزينها في ملف.
string dir = "c:\\temp\\";
// Create a GIF Frame block of 100x100 px.
using (Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock firstBlock = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100))
{
// Fill the entire block in red.
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(firstBlock);
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
gr.FillRectangle(brush, firstBlock.Bounds);
using (Aspose.Imaging.FileFormats.Gif.GifImage gifImage = new Aspose.Imaging.FileFormats.Gif.GifImage(firstBlock))
{
gifImage.Save(dir + "output.gif");
}
}
إنشاء صورة GIF متعددة الصفحات باستخدام صور صفحة واحدة.
static void Main(string[] args)
{
// Load frames
var frames = LoadFrames("Animation frames").ToArray();
// Create GIF image using the first frame
using (var image = new GifImage(new GifFrameBlock(frames[0])))
{
// Add frames to the GIF image using the AddPage method
for (var index = 1; index < frames.Length; index++)
{
image.AddPage(frames[index]);
}
// Save GIF image
image.Save("Multipage.gif");
}
}
private static IEnumerable<rasterimage> LoadFrames(string directory)
{
foreach (var filePath in Directory.GetFiles(directory))
{
yield return (RasterImage)Image.Load(filePath);
}
}</rasterimage>
Constructors
GifImage(GifFrameBlock، IColorPalette)
إطلاق كائن Aspose.Imaging.FileFormats.Gif.GifImage الجديد مع المعلمات المحددةالإطار الأول والخزانة العالمية.بدء إدارة صور GIF بسرعة، وضمانالتمثيل الدقيق مع الإعدادات المخصصة للحصول على نتائج مثالية.
public GifImage(GifFrameBlock firstFrame, IColorPalette globalPalette)
Parameters
firstFrame
GifFrameBlock
الإطار الأول لإطلاق صورة GIF مع.
globalPalette
IColorPalette
يرجى ملاحظة أنه إذا كانت كل من firstFrame’ و
globalPalette’ صفرًا ، فستستخدم اللوحة العالمية الافتراضية.
Examples
هذا المثال يظهر كيفية إنشاء صورة GIF مع لوحة مخصصة وتخزينها إلى ملف.
string dir = "c:\\temp\\";
// Create a GIF Frame block of 100x100 px.
using (Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock firstBlock = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100))
{
// Fill the entire block in red.
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(firstBlock);
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
gr.FillRectangle(brush, firstBlock.Bounds);
// Use 4-bit palette to reduce the image size. The quality can get worse.
Aspose.Imaging.IColorPalette palette = Aspose.Imaging.ColorPaletteHelper.Create4Bit();
using (Aspose.Imaging.FileFormats.Gif.GifImage gifImage = new Aspose.Imaging.FileFormats.Gif.GifImage(firstBlock, palette))
{
gifImage.Save(dir + "output.gif");
}
}
Exceptions
لا يمكن أن يكون firstFrame’ صفرًا
الفئة firstFrame’ تنتمي بالفعل إلى بعض الصور الأخرى.
ينبغي أن يحتوي globalPalette’ المحدد على عدد الإدخالات يساوي قوة 2. الحد الأدنى لحجم اللوحة هو 2 ، الحد الأقصى هو 256.
GifImage(GifFrameBlock)
تصنيع صور GIF يصبح بلا عمل مع Aspose.Imaging.FileFormats.Gif.GifImageمع معيار Frame الأول فقط، فإنه يدخل عالم ديناميكيالتواصل البصري .
public GifImage(GifFrameBlock firstFrame)
Parameters
firstFrame
GifFrameBlock
الإطار الأول لإطلاق صورة GIF مع.
Examples
هذا المثال يظهر كيفية إنشاء صورة GIF وتخزينها في ملف.
string dir = "c:\\temp\\";
// Create a GIF Frame block of 100x100 px.
using (Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock firstBlock = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100))
{
// Fill the entire block in red.
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(firstBlock);
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
gr.FillRectangle(brush, firstBlock.Bounds);
using (Aspose.Imaging.FileFormats.Gif.GifImage gifImage = new Aspose.Imaging.FileFormats.Gif.GifImage(firstBlock))
{
gifImage.Save(dir + "output.gif");
}
}
يظهر المثال التالي كيفية تكوين صورة GIF الرسوم المتحركة من كتل GIF الفردية.
string dir = "c:\\temp\\";
// Create a GIF image 100 x 100 px.
// The first block is fully black by default.
using (Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock firstBlock = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100))
using (Aspose.Imaging.FileFormats.Gif.GifImage gifImage = new Aspose.Imaging.FileFormats.Gif.GifImage(firstBlock))
{
// 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.Gif.Blocks.GifFrameBlock block = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100);
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(block);
gr.FillPie(brush1, block.Bounds, 0, angle);
gifImage.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.Gif.Blocks.GifFrameBlock block = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100);
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(block);
gr.FillPie(brush2, block.Bounds, 0, angle);
gr.FillPie(brush1, block.Bounds, angle, 360 - angle);
gifImage.AddBlock(block);
}
gifImage.Save(dir + "animated_radar.gif");
}
Exceptions
لا يمكن أن يكون firstFrame’ صفرًا
الفئة firstFrame’ تنتمي بالفعل إلى بعض الصور الأخرى.
يجب أن تحتوي اللوحة المحددة على عدد إدخالات يساوي قوة 2. الحد الأدنى لحجم اللوحة هو 2 ، الحد الأقصى هو 256.
GifImage(GifFrameBlock, IColorPalette, بوول, بايت, بايت, بايت, بوول)
ابدأ بسهولة مع Aspose.Imaging.FileFormats.Gif.GifImage constructor.طريقة بسيطة، يمكنك الغوص في إنشاء GIF الرسوم المتحركة بسهولة.firstFrame, globalPalette, paletteColorResolution, aspectRatio, وغيرهاالمعايير، وأنت على استعداد لجلب رؤيتك إلى الحياة.
public GifImage(GifFrameBlock firstFrame, IColorPalette globalPalette, bool isPaletteSorted, byte paletteColorResolution, byte paletteBackgroundColorIndex, byte aspectRatio, bool hasTrailer)
Parameters
firstFrame
GifFrameBlock
الإطار الأول لإطلاق صورة GIF مع.
globalPalette
IColorPalette
يرجى ملاحظة أنه إذا كانت كل من firstFrame’ و
globalPalette’ صفرًا ، فستستخدم اللوحة العالمية الافتراضية.
isPaletteSorted
bool
إذا قمت بتعيين “الحقيقة” يتم تصنيف اللوحة.ملاحظة أن المعلم يستخدم عندما لا يكون globalPalette" صفرًا.
paletteColorResolution
byte
يرجى ملاحظة أن المعيار يستخدم عندما globalPalette’ ليس صفرًا.
paletteBackgroundColorIndex
byte
مؤشر الألوان الخلفية.
aspectRatio
byte
نسب الجانب .
hasTrailer
bool
إذا قمت بتعيين “الحقيقة” صورة GIF لديها متصفح خلاف ذلك لا يوجد متصفح مكتوب في نهاية البث.
Exceptions
لا يمكن أن يكون firstFrame’ صفرًا
الفئة firstFrame’ تنتمي بالفعل إلى بعض الصور الأخرى.
ينبغي أن يحتوي globalPalette’ المحدد على عدد الإدخالات يساوي قوة 2. الحد الأدنى لحجم اللوحة هو 2 ، الحد الأقصى هو 256.
Properties
ActiveFrame
إدارة وتلاعب الإطارات مع هذه الممتلكات، مما يتيح الملاحة السلسة وتعديل الإطار النشط داخل صورة GIF.
public GifFrameBlock ActiveFrame { get; set; }
قيمة الممتلكات
Examples
يظهر المثال التالي كيفية إزالة جميع الكتل من صورة GIF.
using (Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock firstBlock = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100))
using (Aspose.Imaging.FileFormats.Gif.GifImage gifImage = new Aspose.Imaging.FileFormats.Gif.GifImage(firstBlock))
{
if (gifImage.ActiveFrame != null)
{
System.Console.WriteLine("Active frame size: {0}", gifImage.ActiveFrame.Size);
}
else
{
System.Console.WriteLine("Active frame is not set");
}
System.Console.WriteLine("Clear all the blocks");
gifImage.ClearBlocks();
if (gifImage.ActiveFrame != null)
{
System.Console.WriteLine("Active frame size: {0}", gifImage.ActiveFrame.Size);
}
else
{
System.Console.WriteLine("Active frame is not set");
}
}
// The output looks like this:
// Active frame size: { Width = 100, Height = 100}
// Clear all the blocks
// Active frame is not set
BackgroundColor
إدارة لون الخلفية للصورة GIF باستخدام هذه الخصائص.استرداد لون الخلفية لضمان الاتساق وتعزيز الجذب البصري.
public override Color BackgroundColor { get; set; }
قيمة الممتلكات
BackgroundColorIndex
التحكم في مؤشر لون الخلفية للصورة GIF باستخدام هذه الخصائص.استرداد المؤشر للحفاظ على الاتساق أو الحصول على التأثيرات البصرية المرغوب فيها.
public byte BackgroundColorIndex { get; set; }
قيمة الممتلكات
Blocks
احصل على الوصول إلى كتل GIF بسهولة مع هذا الممتلكات ، مما يسهلاسترداد وتلاعب الهياكل البيانات الأساسية للصورة.
public IGifBlock[] Blocks { get; }
قيمة الممتلكات
IGifBlock [ ]
FileFormat
استرداد تنسيق الملف بسهولة مع هذه الممتلكات.لتحديد تنسيق الملفات الخاصة بك.يتم دمجها بسهولة في سير العمل الخاص بك،يقدم معلومات حيوية دون أي إزعاج.
public override FileFormat FileFormat { get; }
قيمة الممتلكات
HasBackgroundColor
هذا الممتلكات يحدد ما إذا كانت صورة GIF تحتوي على لون خلفية.حقا، فإنه يشير إلى أن الصورة تتضمن لون الخلفية.
public override bool HasBackgroundColor { get; }
قيمة الممتلكات
HasTrailer
إدارة وجود متصفح في ملفات GIF الخاصة بك مع هذه الممتلكات.تحتاج إلى التحقق مما إذا كان هناك تريلر أو وضع وجوده ، وهذا الممتلكات يسهلالحفاظ على ملفات GIF الخاصة بك مركبة ومتوافقة مع هذه الميزة البصرية.
public bool HasTrailer { get; set; }
قيمة الممتلكات
HasTransparentColor
تحديد ما إذا كان الإطار النشط للصورة GIF يحتوي على لون شفاف.هذه العقار يوفر وسيلة مريحة للتحقق من الشفافية داخل الصورة.
public override bool HasTransparentColor { get; set; }
قيمة الممتلكات
ImageOpacity
احرص على استبعاد الإطار النشط داخل الصورة ، مما يوفر إدراكًاهذا الممتلكات مفيدة بشكل خاص لفهمدرجة الشفافية أو اللامبالاة من الإطار النشط في الصورة.
public override float ImageOpacity { get; }
قيمة الممتلكات
IsInterlaced
يحدد ما إذا كانت الصورة مترابطة، مما يؤثر على عرضها أثناء التحميل.الممتلكات توفر إدراكًا لسلوك الصورة، أمرًا أساسيًاتحسين استراتيجيات الشحن وتحسين تجربة المشاهدة العامة.
public bool IsInterlaced { get; }
قيمة الممتلكات
IsPaletteSorted
التحكم في تصنيف اللوحة في صور GIF الخاصة بك باستخدام هذه الخصائص.تحتاج إلى التحقق مما إذا كانت لوحة يتم تصنيفها أو إعداد سلوك التصنيف ، هذاالممتلكات توفر وسيلة بسيطة لإدارة المنظمة فيملفات GIF
public bool IsPaletteSorted { get; set; }
قيمة الممتلكات
LoopsCount
احصل على حساب القوس بسهولة مع هذه الممتلكات.إذا كانت صورة GIF الخاصة بك تشملمعلومات الدائرة، هذه الممتلكات تعطيك إمكانية الوصول السريع إلى حساب الدائرة، مما يتيح لكيمكنك الإدارة السليمة للسلوك في ملفات GIF الخاصة بك.
public int LoopsCount { get; set; }
قيمة الممتلكات
PageCount
استرداد العدد الإجمالي للصفحات الموجودة داخل الصورة مع هذاالممتلكات البسيطة مثالية لتقييم سريع نطاق محتوى الصورة.
public override int PageCount { get; }
قيمة الممتلكات
Pages
الحصول على الوصول إلى الصفحات داخل الصورة من خلال هذا الممتلكات المريحة،تتيح الملاحة والتلاعب بشكل مستمر بالصفحات الفردية حسب الحاجة.
public override Image[] Pages { get; }
قيمة الممتلكات
Image [ ]
PaletteColorResolutionBits
إدارة إعدادات الألوان اللوحية لصور GIF الخاصة بك مع هذه الخصائص.عدد البيتات المستخدمة لتمثيل الألوان في اللوحة ، مما يوفر السيطرة الجميلةعلى عمق اللون ونوعية الصورة.
public byte PaletteColorResolutionBits { get; set; }
قيمة الممتلكات
PixelAspectRatio
إدارة نسبة الجانب البكسل للصورة GIF مع هذه الخصائص.النسبة الجانبية لضمان التصوير الدقيق والحفاظ على الولاء البصري.
public byte PixelAspectRatio { get; set; }
قيمة الممتلكات
TransparentColor
احصل على لون شفاف من الإطار النشط في صورة GIF.يسمح لك بالوصول إلى اللون المحدد الذي تم تعيينه على أنه شفاففي إطار النشاط الحالي.
public override Color TransparentColor { get; }
قيمة الممتلكات
XmpData
إدارة بيانات XMP مع هذه الممتلكات.سواء كنت تستفيد من البيانات المعدلة الموجودةأو تحديثها مع معلومات جديدة، وهذا الممتلكات تسريع العملية.بياناتك المنظمة والمتاحة، لضمان أن ملفاتك تحتوي علىالمعلومات ذات الصلة التي يحتاجون إليها.
public override XmpPacketWrapper XmpData { get; set; }
قيمة الممتلكات
Methods
AddBlock(IGIFBLOOK)
إضافة كتلة GIF الجديدة تسمح لك بإدراج بيانات إضافية داخل الصورة.هذه الطريقة تسمح لك بتوصيل الكتل المخصصة إلى صورة GIF ، والتي يمكن أنيحتوي على أنواع مختلفة من المعلومات.
public void AddBlock(IGifBlock block)
Parameters
block
IGifBlock
كتلة GIF لإضافة.
Examples
يظهر المثال التالي كيفية تكوين صورة GIF الرسوم المتحركة من كتل GIF الفردية.
string dir = "c:\\temp\\";
// Create a GIF image 100 x 100 px.
// The first block is fully black by default.
using (Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock firstBlock = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100))
using (Aspose.Imaging.FileFormats.Gif.GifImage gifImage = new Aspose.Imaging.FileFormats.Gif.GifImage(firstBlock))
{
// 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.Gif.Blocks.GifFrameBlock block = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100);
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(block);
gr.FillPie(brush1, block.Bounds, 0, angle);
gifImage.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.Gif.Blocks.GifFrameBlock block = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100);
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(block);
gr.FillPie(brush2, block.Bounds, 0, angle);
gr.FillPie(brush1, block.Bounds, angle, 360 - angle);
gifImage.AddBlock(block);
}
gifImage.Save(dir + "animated_radar.gif");
}
AddPage(RasterImage)
إدراج صفحة جديدة بسهولة في الصورة الحالية، وتحسين محتواهاوتوسيع نطاقها.هذه الطريقة زيادة مجموعات الصور مع المزيدالمحتوى، وتعزيز الإبداع والمرونة في إدارة الصورة والتكوين.
public void AddPage(RasterImage page)
Parameters
page
RasterImage
الصفحة التي أضيفها
Examples
إنشاء صورة GIF متعددة الصفحات باستخدام صور صفحة واحدة.
static void Main(string[] args)
{
// Load frames
var frames = LoadFrames("Animation frames").ToArray();
// Create GIF image using the first frame
using (var image = new GifImage(new GifFrameBlock(frames[0])))
{
// Add frames to the GIF image using the AddPage method
for (var index = 1; index < frames.Length; index++)
{
image.AddPage(frames[index]);
}
// Save GIF image
image.Save("Multipage.gif");
}
}
private static IEnumerable<rasterimage> LoadFrames(string directory)
{
foreach (var filePath in Directory.GetFiles(directory))
{
yield return (RasterImage)Image.Load(filePath);
}
}</rasterimage>
Exceptions
page’ is null.
AdjustBrightness(إنت)
يعدل الضوء في الصورة وفقًا لمعيار الضوء المحدد .هذا الأسلوب يغير الضوء في الصورة بأكملها بشكل متساو، ويزيد أو يقلل من الضوء العام لتحقيق التأثير المطلوب.
public override void AdjustBrightness(int brightness)
Parameters
brightness
int
قيمة الضوء
Examples
في المثال التالي ، يتم إجراء تصحيح الضوء لصورة GIF.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Set the brightness value. The accepted values of brightness are in the range [-255, 255].
gifImage.AdjustBrightness(50);
gifImage.Save(dir + "sample.AdjustBrightness.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
AdjustContrast(السفينة)
تعديل تناقض الصورة، وتعزيز أو تقليل الفرق فيالضوء بين البكسل.هذه الطريقة تعدل نطاق الصورة الإجمالي،جعل المناطق المظلمة أكثر مظلمة ومناطق أكثر إشراقا لتحسين الوضوح البصريو التفاصيل
public override void AdjustContrast(float contrast)
Parameters
contrast
float
قيمة التباين (في نطاق [-100؛ 100])
Examples
في المثال التالي ، يتم إجراء تصحيح تناقض لصورة GIF.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Set the contrast value. The accepted values of contrast are in the range [-100f, 100f].
gifImage.AdjustContrast(50f);
gifImage.Save(dir + "sample.AdjustContrast.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Exceptions
لا يمكن تغيير التباين. مؤشر الإطار: " + frameIndex
AdjustGamma(السفينة)
تحسين جودة الصورة عن طريق تطبيق تصحيح غاما.هذه الطريقة تعدل اللونغاما من الصورة لتحقيق الوضوح البصري الأمثل.إنه يغير قيمة غامامن كل بكسل، مما يؤدي إلى تحسين إصدار الألوان والمظهر العام للصورة.
public override void AdjustGamma(float gamma)
Parameters
gamma
float
غاما لعدد القنوات الحمراء والخضراء
Examples
في المثال التالي ، يتم إجراء تصحيح غاما لصورة GIF.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Set gamma coefficient for red, green and blue channels.
gifImage.AdjustGamma(2.5f);
gifImage.Save(dir + "sample.AdjustGamma.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
AdjustGamma(السفينة، السفينة، السفينة)
تصحيح غاما للصورة ينطبق على تعديل غير خطي لقيم البكسل،تعزيز أو تقليل الضوء على أساس المؤشرات المحددة لللون الأحمر،الخضراء، والقنوات الزرقاء.هذه الطريقة تساعد على تزيين توازن الألوان وإضاءة الصورة، وتحسين مظهرها العام والجودة البصرية.
public override void AdjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
Parameters
gammaRed
float
القناة الحمراء معدل القناة الحمراء
gammaGreen
float
غاما لـ قناة خضراء
gammaBlue
float
القناة الزرقاء معدل القناة الزرقاء
Examples
يقدم المثال التالي تصحيح غاما للصورة GIF التي تطبق مؤشرات مختلفة على مكونات الألوان.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Set individual gamma coefficients for red, green and blue channels.
gifImage.AdjustGamma(1.5f, 2.5f, 3.5f);
gifImage.Save(dir + "sample.AdjustGamma.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
BinarizeBradley(مزدوجة)
ثنائي الصورة باستخدام خوارزمية الحد الأقصى التكيفية لـ Bradleyالحد الأقصى للصورة المتكاملة هو طريقة لتحويل الصورة الرمادية إلى صورةهذه الخوارزميات تحسب الحد الأقصى المحلي لكل بكسل استنادا إلىمتوسط كثافة البكسلات المحيطة داخل نافذة محددة.تعديل الحد الأقصى بشكل قابل للتكيف استنادًا إلى كثافة البكسل المحلية ،الطريقة فعالة في التعامل مع الاختلافات في الإضاءة والتباين في جميع أنحاء الصورة.
public override void BinarizeBradley(double brightnessDifference)
Parameters
brightnessDifference
double
الفرق في الضوء بين البكسل ومتوسط نافذة s x s من البكسل المركزة حول هذا البكسل.
BinarizeFixed(بيوت)
ثنائي الصورة مع الحد الأقصى المحدد تحويل صخرة أو لونصورة إلى صورة ثنائية ، حيث يتم تصنيف كل بكسل على أنها سوداء أو بيضاءعلى أساس ما إذا كانت قيمة الكثافة تتجاوز الحد الأقصى المحدد.
public override void BinarizeFixed(byte threshold)
Parameters
threshold
byte
إذا كانت القيمة الرمادية المقابلة للبكسل أكبر من الحد الأقصى، سيتم تخصيص قيمة 255 لها، 0 خلاف ذلك.
Examples
على سبيل المثال التالي ثنائي صورة GIF مع الحد المحدد مسبقا.الصور الثنائية تحتوي على 2 ألوان فقط - الأسود والأبيض.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage djvuImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Binarize the image with a threshold value of 127.
// If a corresponding gray value of a pixel is greater than 127, a value of 255 will be assigned to it, 0 otherwise.
djvuImage.BinarizeFixed(127);
djvuImage.Save(dir + "sample.BinarizeFixed.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
BinarizeOtsu()
ثنائي الصورة مع حافة أوتسو هو طريقة تستخدم تلقائياتحديد قيمة الحد الأقصى الأمثل لتحويل صورة على مقياس رمادي إلىالصورة الثنائية.الخوارزميات الحد الأقصى Otsu يحسب الحد الأقصى الذييقلل من التحول داخل الطبقة من كثافة البكسل في اثنين من النتائجالفصول الدراسية (الخلفية والخلفية) هذه التقنية مفيدة بشكل خاص عندماقيمة الحد الأقصى الأمثل غير معروفة ويجب تحديدها على أساس التكيفعلى هيستوغرام الصورة.
public override void BinarizeOtsu()
Examples
على سبيل المثال التالي ثنائي صورة GIF مع أطراف Otsu. الصور الثنائية تحتوي على 2 ألوان فقط - الأسود والأبيض.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Binarize the image with Otsu thresholding.
gifImage.BinarizeOtsu();
gifImage.Save(dir + "sample.BinarizeOtsu.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
ClearBlocks()
إزالة جميع الكتل GIF يزيل أي بيانات موجودة المخزنة داخل الصورة.هذه العملية تعيد بفعالية الصورة إلى حالة فارغة، وإزالة أياستخدم هذه الطريقة عندما تحتاج إلى البدء الطازج مع نظيفةلإنشاء أو تعديل صورة GIF.
public void ClearBlocks()
Examples
يظهر المثال التالي كيفية إزالة جميع الكتل من صورة GIF.
using (Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock firstBlock = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100))
using (Aspose.Imaging.FileFormats.Gif.GifImage gifImage = new Aspose.Imaging.FileFormats.Gif.GifImage(firstBlock))
{
if (gifImage.ActiveFrame != null)
{
System.Console.WriteLine("Active frame size: {0}", gifImage.ActiveFrame.Size);
}
else
{
System.Console.WriteLine("Active frame is not set");
}
System.Console.WriteLine("Clear all the blocks");
gifImage.ClearBlocks();
if (gifImage.ActiveFrame != null)
{
System.Console.WriteLine("Active frame size: {0}", gifImage.ActiveFrame.Size);
}
else
{
System.Console.WriteLine("Active frame is not set");
}
}
// The output looks like this:
// Active frame size: { Width = 100, Height = 100}
// Clear all the blocks
// Active frame is not set
Crop(Rectangle)
زراعة الصورة باستخدام منطقة مستقيمة محددة.هذه العملية إزالة الخارججزء من الصورة، وترك فقط المنطقة المحددة من خلال المستطيل.
public override void Crop(Rectangle rectangle)
Parameters
rectangle
Rectangle
من المستطيل .
Examples
يتم تحديد منطقة الحصاد من خلال Aspose.Imaging.Rectangle.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Crop the image. The cropping area is the rectangular central area of the image.
Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(gifImage.Width / 4, gifImage.Height / 4, gifImage.Width / 2, gifImage.Height / 2);
gifImage.Crop(area);
// Save the cropped image to PNG
gifImage.Save(dir + "sample.Crop.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Dither(DitheringMethod، int، IColorPalette)
تطبيق ديتيرين على الصورة الحالية.هذا العملية تعزز جودة الصورة عن طريقانخفاض الارتباط باللون وتحسين الانتقال باللون، مما يؤدي إلىظهوره
public override void Dither(DitheringMethod ditheringMethod, int bitsCount, IColorPalette customPalette)
Parameters
ditheringMethod
DitheringMethod
الطريقة المضغوطة .
bitsCount
int
النقاط النهائية تحسب لالتقاط.
customPalette
IColorPalette
أضف تعليق لـ DITERING.
Examples
يحتوي المثال التالي على صورة GIF ويقوم بتحريك الحد الأقصى والتدفق باستخدام عمق مختلف في اللوحة.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Perform threshold dithering using 4-bit color palette which contains 16 colors.
// The more bits specified the higher quality and the bigger size of the output image.
// Note that only 1-bit, 4-bit and 8-bit palettes are supported at the moment.
gifImage.Dither(Aspose.Imaging.DitheringMethod.ThresholdDithering, 4, null);
gifImage.Save(dir + "sample.ThresholdDithering4.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Perform floyd dithering using 1-bit color palette which contains only 2 colors - black and white.
// The more bits specified the higher quality and the bigger size of the output image.
// Note that only 1-bit, 4-bit and 8-bit palettes are supported at the moment.
gifImage.Dither(Aspose.Imaging.DitheringMethod.FloydSteinbergDithering, 1, null);
gifImage.Save(dir + "sample.FloydSteinbergDithering1.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Filter(الخيارات الثنائية، FilterOptionsBase)
تطبيق مرشح محدد على المنطقة المحددة للصورة، وتعزيز رؤيتهاالجودة أو تغيير مظهرها كما هو مطلوب.هذه الطريقة تتعامل بشكل انتقائيبكسل داخل المستطيل المحدد، مما يسمح بإجراء تعديلات مستهدفةمع الحفاظ على سلامة بيانات الصورة المحيطة.
public override void Filter(Rectangle rectangle, FilterOptionsBase options)
Parameters
rectangle
Rectangle
من المستطيل .
options
FilterOptionsBase
الخيارات .
Examples
على سبيل المثال التالي تنطبق أنواع مختلفة من الفلاتر على صورة GIF.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Apply a median filter with a rectangle size of 5 to the entire image.
gifImage.Filter(gifImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.MedianFilterOptions(5));
gifImage.Save(dir + "sample.MedianFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Apply a bilateral smoothing filter with a kernel size of 5 to the entire image.
gifImage.Filter(gifImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.BilateralSmoothingFilterOptions(5));
gifImage.Save(dir + "sample.BilateralSmoothingFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Apply a Gaussian blur filter with a radius of 5 and a sigma value of 4.0 to the entire image.
gifImage.Filter(gifImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.GaussianBlurFilterOptions(5, 4.0));
gifImage.Save(dir + "sample.GaussianBlurFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Apply a Gauss-Wiener filter with a radius of 5 and a smooth value of 4.0 to the entire image.
gifImage.Filter(gifImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.GaussWienerFilterOptions(5, 4.0));
gifImage.Save(dir + "sample.GaussWienerFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)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.
gifImage.Filter(gifImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.MotionWienerFilterOptions(10, 1.0, 90.0));
gifImage.Save(dir + "sample.MotionWienerFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Apply a sharpen filter with a kernel size of 5 and a sigma value of 4.0 to the entire image.
gifImage.Filter(gifImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.SharpenFilterOptions(5, 4.0));
gifImage.Save(dir + "sample.SharpenFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
GetOriginalOptions()
استرداد الخيارات الأصلية القائمة على إعدادات الملفات، حيوية للحفاظ على الولاءوالاتساق في معالجة الصور والتلاعب.هذه الطريقة تسمحإدماج المعلمات المحددة للملفات في العمليات اللاحقة، وضمانالتسليم الدقيق والالتزام بالخصائص الأصلية للصورة.هذا يمكن أن يكون مفيدًا للحفاظ على عمق القطع وغيرها من المعلمات في الصورة الأصلية دون تغيير.على سبيل المثال ، إذا قمنا بتحميل صورة PNG باللون الأسود والأبيض بـ 1 بت لكل بكسل ثم قمنا بتخزينها باستخدامطريقة Aspose.Imaging.DataStreamSupporter.Save(System.String) ، سيتم إنتاج صورة PNG الناتجة مع 8 بت لكل بكسل.لتجنب ذلك وتخزين صورة PNG مع 1 بت لكل بكسل ، استخدم هذه الطريقة للحصول على خيارات التخزين المقابلة وتجاوزهاإلى طريقة Aspose.Imaging.Image.Save(System.String،Aspose.Imaging.ImageOptionsBase) كمعيار ثانٍ.
public override ImageOptionsBase GetOriginalOptions()
Returns
الخيارات القائمة على إعدادات الملف الأصلي.
Grayscale()
تحويل الصورة إلى تمثيلها الرمادي يحول اللونصورة إلى نسخة رمادية عن طريق إزالة معلومات الألوان مع الحفاظ علىهذا العملية يسهل الصورة إلى ظلال الرمادي ، مما يجعلها مناسبةلتطبيقات مختلفة مثل الطباعة، ومعالجة المستندات، و grayscaleالتحليل .
public override void Grayscale()
Examples
يتحول المثال التالي صورة GIF الملونة إلى تمثيلها الرمادي.تتكون صور Grayscale حصريًا من الظلال الرمادية وتحمل فقط معلومات الكثافة.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
gifImage.Grayscale();
gifImage.Save(dir + "sample.Grayscale.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
InsertBlock(إيت، IGifBlock)
إدراج كتلة GIF الجديدة يسمح لك بإضافة بيانات مخصصة في موقع معينداخل الصورة.هذه الطريقة تسمح لك لوضع الكتل المخصصة فيموقع في صورة GIF، وتوفير مرونة في تنظيم وتنظيمبيانات الصورة
public void InsertBlock(int index, IGifBlock block)
Parameters
index
int
العنصر القائم على الصفر ، الذي سيتم إدراج الكتلة فيه.
block
IGifBlock
كتلة GIF لإضافة.
OnPaletteChanged(الألوان، الألوان، الألوان)
يتم استدعاءها عندما يتم تغيير اللوحة.
protected override void OnPaletteChanged(IColorPalette oldPalette, IColorPalette newPalette)
Parameters
oldPalette
IColorPalette
البلاط القديم
newPalette
IColorPalette
البلاط الجديد
OnPaletteChanging(الألوان، الألوان، الألوان)
يتم استدعاءها عندما يتغير اللوحة.
protected override void OnPaletteChanging(IColorPalette oldPalette, IColorPalette newPalette)
Parameters
oldPalette
IColorPalette
البلاط القديم
newPalette
IColorPalette
البلاط الجديد
OrderBlocks()
ترتيب كتل GIF وفقا لمواصفات GIF يضمن GIF المناسبالتخطيط والتوافق مع المعيار.هذا العملية يتضمن ترتيبالكتلة في التسلسل الصحيح كما هو محدد من قبل المواصفات.قد يشمل إزالة بعض Aspose.Imaging.FileFormats.Gif.Blocks.GifGraphicsControlBlock الحالات التيلا تحتاج إلى التخطيط النهائي.من خلال الامتثال لمواصفات GIF ، فإنسيتم تشكيل الصورة الناتجة بشكل صحيح ومتوافقة مع عرض GIFالتطبيقات
public void OrderBlocks()
RemoveBlock(IGIFBLOOK)
إزالة كتلة GIF إزالة البيانات المحددة من الصورة، وتوفير القدرة علىتنظيف أو تعديل هيكل الصورة.هذه الطريقة تسمح لك لإزالة غير مرغوب فيهاأو الكتل غير الضرورية، وتحسين صورة GIF لتخزين فعال.وظيفية إزالة المعلومات المفقودة من الصورة مع الحفاظ علىسلامتها ونوعيتها.
public void RemoveBlock(IGifBlock block)
Parameters
block
IGifBlock
الكتلة لإزالتها.
Remarks
ملاحظة: لا تنسى وضع الكتلة إذا لم تضيفها إلى بعض GifImage الأخرى.
Resize(int، int، resizeType)
إعادة تعيين هذا Aspose.Imaging.Image المثال.
public override void Resize(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
int
العرض الجديد .
newHeight
int
الارتفاع الجديد
resizeType
ResizeType
هذا النوع من التراجع.
Examples
هذا المثال يحمل صورة GIF ويعيدها باستخدام أساليب إعادة التدوير المختلفة.
string dir = "c:\\temp\\";
using (Aspose.Imaging.FileFormats.Gif.GifImage image = (Aspose.Imaging.FileFormats.Gif.GifImage)Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
// Scale up by 2 times using Nearest Neighbour resampling.
image.Resize(image.Width* 2, image.Height* 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
image.Save(dir + "upsample.nearestneighbour.gif");
}
using (Aspose.Imaging.FileFormats.Gif.GifImage image = (Aspose.Imaging.FileFormats.Gif.GifImage)Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
// Scale down by 2 times using Nearest Neighbour resampling.
image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
image.Save(dir + "downsample.nearestneighbour.gif");
}
using (Aspose.Imaging.FileFormats.Gif.GifImage image = (Aspose.Imaging.FileFormats.Gif.GifImage)Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
// Scale up by 2 times using Bilinear resampling.
image.Resize(image.Width* 2, image.Height* 2, Aspose.Imaging.ResizeType.BilinearResample);
image.Save(dir + "upsample.bilinear.gif");
}
using (Aspose.Imaging.FileFormats.Gif.GifImage image = (Aspose.Imaging.FileFormats.Gif.GifImage)Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
// Scale down by 2 times using Bilinear resampling.
image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.BilinearResample);
image.Save(dir + "downsample.bilinear.gif");
}
Resize(إنت، إنت، ImageResizeSettings)
إعادة تعيين هذا Aspose.Imaging.Image المثال.
public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)
Parameters
newWidth
int
العرض الجديد .
newHeight
int
الارتفاع الجديد
settings
ImageResizeSettings
من الإعدادات .
Examples
هذا المثال يحمل صورة GIF ويعيدها باستخدام إعدادات إعادة التدوير المختلفة.
string dir = "c:\\temp\\";
Aspose.Imaging.ImageResizeSettings resizeSettings = new Aspose.Imaging.ImageResizeSettings();
// The adaptive algorithm based on weighted and blended rational function and lanczos3 interpolation.
resizeSettings.Mode = Aspose.Imaging.ResizeType.AdaptiveResample;
// The small rectangular filter
resizeSettings.FilterType = Aspose.Imaging.ImageFilterType.SmallRectangular;
// The number of colors in the palette.
resizeSettings.EntriesCount = 256;
// The color quantization is not used
resizeSettings.ColorQuantizationMethod = ColorQuantizationMethod.None;
// The euclidian method
resizeSettings.ColorCompareMethod = ColorCompareMethod.Euclidian;
using (Aspose.Imaging.Image image = (Aspose.Imaging.Image)Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Scale down by 2 times using adaptive resampling.
gifImage.Resize(image.Width / 2, image.Height / 2, resizeSettings);
// Save to PNG
gifImage.Save(dir + "downsample.adaptive.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
ResizeFullFrame(int، int، resizeType)
إعادة تدوير الصورة مع الأخذ في الاعتبار الإطارات الكاملة لكل صفحة فيGIF، وبالتالي منع المواد المحتملة من الظهور.الحفاظ على سلامة ونوعية الصورة، وخاصة عند التعامل معGIF الرسوم المتحركة أو سلسلة من الإطارات.
public void ResizeFullFrame(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
int
العرض الجديد .
newHeight
int
الارتفاع الجديد
resizeType
ResizeType
هذا النوع من التراجع.
ResizeProportional(int، int، resizeType)
ويحافظ التراجع النسبي على نسبة الجانب من الصورة أثناء تعديل حجمها، لضمان أن الصورة لا تبدو متمددة أو مكسورة.هذه الطريقة تراجع الصورة نسبيا، وتقيس كل من العرض والارتفاع بنفس العامل.سيقوم التراجع النسبي بتراجع كل إطار حسب نسبة newWidth’/width و
newHeight’/height.
public void ResizeProportional(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
int
العرض الجديد .
newHeight
int
الارتفاع الجديد
resizeType
ResizeType
هذا النوع من التراجع.
Rotate(البول، البول، اللون)
هذه الطريقة تدور الصورة حول نقطتها المركزية.من خلال تحديد الدورانفي الزاوية، يمكنك تحويل الصورة في اتجاه الساعة أو في اتجاه مواجهة الساعة لتحقيقهذا الدوران يساعد على ضبط عرض الصورة أوالتوافق دون إفساد محتواه.
public override void Rotate(float angle, bool resizeProportionally, Color backgroundColor)
Parameters
angle
float
زاوية الدوران في درجات.القيم الإيجابية سوف تدور في اتجاه الساعة.
resizeProportionally
bool
إذا قمت بتعيين “الحقيقي” ستكون حجم الصورة الخاص بك قد تغيرتعلى النحو المنحني (نقاط الزاوية) المشاهدات في الحالة الأخرى التي تترك الأبعاد غير ملموسة فقطالداخلية محتوى الصورة يتم توجيهها.
backgroundColor
Color
لون الخلفية
RotateFlip(RotateFlipType)
أداء الدوران أو التزلج أو كليهما على الإطار النشط حصريًا.تنطبق التحولات فقط على الإطار النشط الحالي للصورة ،الحفاظ على سلامة الإطارات الأخرى في التسلسل.
public override void RotateFlip(RotateFlipType rotateFlipType)
Parameters
rotateFlipType
RotateFlipType
نوع الفليب المتحرك.
Examples
ويحمل هذا المثال صورة GIF، ويحولها بنسبة 90 درجة في اتجاه الساعة، ويحمل الخيارية الصورة أفقياً و(أو) عمودياً.
string dir = "c:\\temp\\";
Aspose.Imaging.RotateFlipType[] rotateFlipTypes = new Aspose.Imaging.RotateFlipType[]
{
Aspose.Imaging.RotateFlipType.Rotate90FlipNone,
Aspose.Imaging.RotateFlipType.Rotate90FlipX,
Aspose.Imaging.RotateFlipType.Rotate90FlipXY,
Aspose.Imaging.RotateFlipType.Rotate90FlipY,
};
foreach (Aspose.Imaging.RotateFlipType rotateFlipType in rotateFlipTypes)
{
// Rotate, flip and save to the output file.
using (Aspose.Imaging.FileFormats.Gif.GifImage image = (Aspose.Imaging.FileFormats.Gif.GifImage)Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
image.RotateFlip(rotateFlipType);
image.Save(dir + "sample." + rotateFlipType + ".png", new Aspose.Imaging.ImageOptions.PngOptions());
}
}
SaveData(Stream)
تخزين البيانات
protected override void SaveData(Stream stream)
Parameters
stream
Stream
تدفق لتخزين البيانات.
SetFrameTime(يوفنتوس)
ضبط مدة كل إطار في مللي ثانية، وضمان التوقيت المتسقطوال سلسلة الصورة.هذه الطريقة تحدد بشكل موحد وقت العرض لكل إطار، مما يتيح التحكم الدقيق في سرعة الرسوم المتحركة.تغيير هذه القيمة سوف يعيد تأخير لجميع الإطارات.
public void SetFrameTime(ushort time)
Parameters
time
ushort
مدة الإطار في مللي ثانية.
UpdateDimensions(إنت، إنت)
تحديث أبعاد الصورة.
protected override void UpdateDimensions(int newWidth, int newHeight)
Parameters
newWidth
int
عرض الصورة الجديد.
newHeight
int
ارتفاع الصورة الجديدة.