Class GifOptions
이름 공간 : Aspose.Imaging.ImageOptions 모임: Aspose.Imaging.dll (25.4.0)
API for Graphical Interchange Format (GIF) 라스터 이미지 파일 만들기 제공개발자는 정확한 GIF 이미지를 생성하기위한 포괄적 인 옵션컨트롤 : 배경 색상, 색상 팔레트, 해상도를 설정할 수 있는 기능을 갖추고,상호 연결된 유형, 투명한 색상, XMP 메타 데이터 컨테이너 및 이미지압축, 이 API는 유연성과 효율성을 보장합니다 최적화 된 만들기그리고 구체적인 응용 요구 사항에 맞는 시각적으로 매력적인 GIF.
[JsonObject(MemberSerialization.OptIn)]
public class GifOptions : ImageOptionsBase, IDisposable, IHasXmpData, IHasMetadata, ICloneable
Inheritance
object ← DisposableObject ← ImageOptionsBase ← GifOptions
Implements
IDisposable , IHasXmpData , IHasMetadata , ICloneable
상속 회원들
ImageOptionsBase.Clone() , ImageOptionsBase.ReleaseManagedResources() , ImageOptionsBase.KeepMetadata , ImageOptionsBase.XmpData , ImageOptionsBase.Source , ImageOptionsBase.Palette , ImageOptionsBase.ResolutionSettings , ImageOptionsBase.VectorRasterizationOptions , ImageOptionsBase.BufferSizeHint , ImageOptionsBase.MultiPageOptions , ImageOptionsBase.FullFrame , ImageOptionsBase.ProgressEventHandler , DisposableObject.Dispose() , DisposableObject.ReleaseManagedResources() , DisposableObject.ReleaseUnmanagedResources() , DisposableObject.VerifyNotDisposed() , DisposableObject.Disposed , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
이 예제는 SaveOptions Namespace에서 수출 목적으로 다른 클래스를 사용하는 것을 보여줍니다.Gif 형식의 이미지가 이미지의 예제로 업로드되고 여러 형식으로 수출됩니다.
string dir = "c:\\temp\\";
//Load an existing image (of type Gif) in an instance of Image class
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
//Export to BMP file format using the default options
image.Save(dir + "output.bmp", new Aspose.Imaging.ImageOptions.BmpOptions());
//Export to JPEG file format using the default options
image.Save(dir + "output.jpg", new Aspose.Imaging.ImageOptions.JpegOptions());
//Export to PNG file format using the default options
image.Save(dir + "output.png", new Aspose.Imaging.ImageOptions.PngOptions());
//Export to TIFF file format using the default options
image.Save(dir + "output.tif", new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default));
}
다음 예제는 특정 이미지 유형을 참조하지 않고 여러 페이지 벡터 이미지를 일반적으로 GIF 형식으로 변환하는 방법을 보여줍니다.
string dir = "C:\\aspose.imaging\\net\\misc\\ImagingReleaseQATester\\Tests\\testdata\\2548";
string inputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr");
string outputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr.gif");
Aspose.Imaging.ImageOptionsBase exportOptions = new Aspose.Imaging.ImageOptions.GifOptions();
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFilePath))
{
exportOptions.MultiPageOptions = null;
// Export only first two pages. These pages will be presented as animated frames in the output GIF.
Aspose.Imaging.IMultipageImage multipageImage = image as Aspose.Imaging.IMultipageImage;
if (multipageImage != null && (multipageImage.Pages != null && multipageImage.PageCount > 2))
{
exportOptions.MultiPageOptions = new Aspose.Imaging.ImageOptions.MultiPageOptions(new Aspose.Imaging.IntRange(0, 2));
}
if (image is Aspose.Imaging.VectorImage)
{
exportOptions.VectorRasterizationOptions = (Aspose.Imaging.ImageOptions.VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Aspose.Imaging.Color.White, image.Width, image.Height });
exportOptions.VectorRasterizationOptions.TextRenderingHint = Aspose.Imaging.TextRenderingHint.SingleBitPerPixel;
exportOptions.VectorRasterizationOptions.SmoothingMode = Aspose.Imaging.SmoothingMode.None;
}
image.Save(outputFilePath, exportOptions);
}
이 예제는 유형 색상 범위에서 픽셀 정보를 업로드하는 방법을 보여주고, 범위를 조작하고 이미지로 다시 설정합니다.이 작업을 수행하려면 이 예제는 새로운 이미지 파일 (GIF 형식) uisng MemoryStream 개체를 생성합니다.
//Create an instance of MemoryStream
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
//Create an instance of GifOptions and set its various properties including the Source property
Aspose.Imaging.ImageOptions.GifOptions gifOptions = new Aspose.Imaging.ImageOptions.GifOptions();
gifOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(gifOptions, 500, 500))
{
//Get the pixels of image by specifying the area as image boundary
Aspose.Imaging.Color[] pixels = image.LoadPixels(image.Bounds);
//Loop over the Array and sets color of alrenative indexed pixel
for (int index = 0; index < pixels.Length; index++)
{
if (index % 2 == 0)
{
//Set the indexed pixel color to yellow
pixels[index] = Aspose.Imaging.Color.Yellow;
}
else
{
//Set the indexed pixel color to blue
pixels[index] = Aspose.Imaging.Color.Blue;
}
}
//Apply the pixel changes to the image
image.SavePixels(image.Bounds, pixels);
// save all changes.
image.Save();
}
// Write MemoryStream to File
using (System.IO.FileStream fileStream = new System.IO.FileStream(@"C:\temp\output.gif", System.IO.FileMode.Create))
{
stream.WriteTo(fileStream);
}
}
Constructors
GifOptions()
Aspose.Imaging.ImageOptions.GifOptions 클래스의 새로운 예를 시작합니다.
[JsonConstructor]
public GifOptions()
GifOptions(GifOptions)
Aspose.Imaging.ImageOptions.GifOptions 클래스의 새로운 예를 시작합니다.
public GifOptions(GifOptions gifOptions)
Parameters
gifOptions
GifOptions
GIF 옵션
Properties
BackgroundColor
배경 색을 얻거나 설정합니다.
[JsonProperty]
public Color BackgroundColor { get; set; }
부동산 가치
BackgroundColorIndex
GIF 배경 색상 인덱스를 얻거나 설정합니다.
public byte BackgroundColorIndex { get; set; }
부동산 가치
ColorResolution
GIF 색상 해상도를 얻거나 설정합니다.
public byte ColorResolution { get; set; }
부동산 가치
Examples
이 예제는 다양한 옵션을 사용하여 BMP 이미지를 GIF 형식으로 저장하는 방법을 보여줍니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(1000, 1000))
{
// Fill the entire image with the blue-yellow gradient.
Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
new Aspose.Imaging.Point(0, 0),
new Aspose.Imaging.Point(bmpImage.Width, bmpImage.Height),
Aspose.Imaging.Color.Blue,
Aspose.Imaging.Color.Yellow);
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(bmpImage);
graphics.FillRectangle(gradientBrush, bmpImage.Bounds);
Aspose.Imaging.ImageOptions.GifOptions saveOptions = new Aspose.Imaging.ImageOptions.GifOptions();
// The number of bits required to store a color, minus 1.
saveOptions.ColorResolution = 7;
// Palette correction means that whenever image is exported to GIF the source image colors will be analyzed
// in order to build the best matching palette (in case image Palette does not exist or not specified in the options)
saveOptions.DoPaletteCorrection = true;
// Load a GIF image in a progressive way.
// An interlaced GIF doesn't display its scanlines linearly from top to bottom, but instead reorders it
// so the content of the GIF becomes clear even before it finishes loading.
saveOptions.Interlaced = true;
// Save as a lossless GIF.
using (System.IO.Stream stream = System.IO.File.OpenWrite(dir + "output.gif"))
{
bmpImage.Save(stream, saveOptions);
System.Console.WriteLine("The size of the lossless GIF: {0} bytes.", stream.Length);
}
// Set the maximum allowed pixel difference. If greater than zero, lossy compression will be used.
// The recommended value for optimal lossy compression is 80. 30 is very light compression, 200 is heavy.
saveOptions.MaxDiff = 80;
// Save as a lossy GIF.
using (System.IO.Stream stream = System.IO.File.OpenWrite(dir + "output.lossy.gif"))
{
bmpImage.Save(stream, saveOptions);
System.Console.WriteLine("The size of the lossy GIF: {0} bytes.", stream.Length);
}
}
//The output may look like this:
//The size of the lossless GIF: 212816 bytes.
//The size of the lossy GIF: 89726 bytes.
Remarks
색상 해상도 - 기본 색상 당 비트 수원본 이미지, minus 1.이 값은 크기를 나타냅니다그래픽의 색상이 있는 전체 팔레트는선택, 그림에서 실제로 사용되는 색상의 수가 아닙니다.예를 들어, 이 필드의 값이 3인 경우, 이 필드의 값은원본 이미지에는 원본 색상 당 4비트가 생성될 수 있습니다.이 값은 부유함을 나타내기 위해 설정되어야 합니다.원래 패널, 모든 색상이 아닌 경우에도팔레트는 출처 기계에서 사용할 수 있습니다.
DoPaletteCorrection
팔레트 수정이 적용되는지 여부를 나타내는 값을 얻거나 설정합니다.
public bool DoPaletteCorrection { get; set; }
부동산 가치
Examples
이 예제는 다양한 옵션을 사용하여 BMP 이미지를 GIF 형식으로 저장하는 방법을 보여줍니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(1000, 1000))
{
// Fill the entire image with the blue-yellow gradient.
Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
new Aspose.Imaging.Point(0, 0),
new Aspose.Imaging.Point(bmpImage.Width, bmpImage.Height),
Aspose.Imaging.Color.Blue,
Aspose.Imaging.Color.Yellow);
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(bmpImage);
graphics.FillRectangle(gradientBrush, bmpImage.Bounds);
Aspose.Imaging.ImageOptions.GifOptions saveOptions = new Aspose.Imaging.ImageOptions.GifOptions();
// The number of bits required to store a color, minus 1.
saveOptions.ColorResolution = 7;
// Palette correction means that whenever image is exported to GIF the source image colors will be analyzed
// in order to build the best matching palette (in case image Palette does not exist or not specified in the options)
saveOptions.DoPaletteCorrection = true;
// Load a GIF image in a progressive way.
// An interlaced GIF doesn't display its scanlines linearly from top to bottom, but instead reorders it
// so the content of the GIF becomes clear even before it finishes loading.
saveOptions.Interlaced = true;
// Save as a lossless GIF.
using (System.IO.Stream stream = System.IO.File.OpenWrite(dir + "output.gif"))
{
bmpImage.Save(stream, saveOptions);
System.Console.WriteLine("The size of the lossless GIF: {0} bytes.", stream.Length);
}
// Set the maximum allowed pixel difference. If greater than zero, lossy compression will be used.
// The recommended value for optimal lossy compression is 80. 30 is very light compression, 200 is heavy.
saveOptions.MaxDiff = 80;
// Save as a lossy GIF.
using (System.IO.Stream stream = System.IO.File.OpenWrite(dir + "output.lossy.gif"))
{
bmpImage.Save(stream, saveOptions);
System.Console.WriteLine("The size of the lossy GIF: {0} bytes.", stream.Length);
}
}
//The output may look like this:
//The size of the lossless GIF: 212816 bytes.
//The size of the lossy GIF: 89726 bytes.
Remarks
팔레트 수정은 이미지가 GIF로 내보낼 때마다 출처 이미지 색상이 분석됩니다.가장 적합한 패널을 구축하기 위해 (그림 패널이 존재하지 않거나 옵션에 명시되지 않은 경우).분석 과정은 시간이 걸리지만 출력 이미지는 가장 적합한 색상 패널을 갖게 될 것이며 결과는 시각적으로 더 좋습니다.
HasTrailer
GIF가 트레일러가 있는지 여부를 나타내는 값을 얻거나 설정합니다.
public bool HasTrailer { get; set; }
부동산 가치
HasTransparentColor
GIF 이미지가 투명한 색상이 있는지 여부를 나타내는 값을 얻거나 설정합니다.반환값이 되면 0 0 0 0, 이 재산은 출처 이미지 맥락에 의해 과장됩니다.
[JsonProperty]
public bool? HasTransparentColor { get; set; }
부동산 가치
bool ?
Interlaced
이미지가 연결되어 있어야 한다면 사실이다.
public bool Interlaced { get; set; }
부동산 가치
Examples
이 예제는 다양한 옵션을 사용하여 BMP 이미지를 GIF 형식으로 저장하는 방법을 보여줍니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(1000, 1000))
{
// Fill the entire image with the blue-yellow gradient.
Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
new Aspose.Imaging.Point(0, 0),
new Aspose.Imaging.Point(bmpImage.Width, bmpImage.Height),
Aspose.Imaging.Color.Blue,
Aspose.Imaging.Color.Yellow);
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(bmpImage);
graphics.FillRectangle(gradientBrush, bmpImage.Bounds);
Aspose.Imaging.ImageOptions.GifOptions saveOptions = new Aspose.Imaging.ImageOptions.GifOptions();
// The number of bits required to store a color, minus 1.
saveOptions.ColorResolution = 7;
// Palette correction means that whenever image is exported to GIF the source image colors will be analyzed
// in order to build the best matching palette (in case image Palette does not exist or not specified in the options)
saveOptions.DoPaletteCorrection = true;
// Load a GIF image in a progressive way.
// An interlaced GIF doesn't display its scanlines linearly from top to bottom, but instead reorders it
// so the content of the GIF becomes clear even before it finishes loading.
saveOptions.Interlaced = true;
// Save as a lossless GIF.
using (System.IO.Stream stream = System.IO.File.OpenWrite(dir + "output.gif"))
{
bmpImage.Save(stream, saveOptions);
System.Console.WriteLine("The size of the lossless GIF: {0} bytes.", stream.Length);
}
// Set the maximum allowed pixel difference. If greater than zero, lossy compression will be used.
// The recommended value for optimal lossy compression is 80. 30 is very light compression, 200 is heavy.
saveOptions.MaxDiff = 80;
// Save as a lossy GIF.
using (System.IO.Stream stream = System.IO.File.OpenWrite(dir + "output.lossy.gif"))
{
bmpImage.Save(stream, saveOptions);
System.Console.WriteLine("The size of the lossy GIF: {0} bytes.", stream.Length);
}
}
//The output may look like this:
//The size of the lossless GIF: 212816 bytes.
//The size of the lossy GIF: 89726 bytes.
IsPaletteSorted
팔레트 입력이 정렬되었는지 여부를 나타내는 값을 얻거나 설정합니다.
public bool IsPaletteSorted { get; set; }
부동산 가치
LoopsCount
수신 또는 로프 계산을 설정합니다 (기본 1 로프)
public int LoopsCount { get; set; }
부동산 가치
MaxDiff
최대 허용 된 픽셀 차이를 얻거나 설정합니다. 0 이상의 경우 손실 압축이 사용됩니다.최적의 손실 압축을위한 권장 값은 80. 30은 매우 가벼운 압축이며 200은 무겁습니다.그것은 작은 손실 만 도입 할 때 가장 잘 작동하고 압축 알고리즘의 제한으로 인해 매우 높은 손실 수준은 많은 이익을 제공하지 않습니다.허용된 값의 범위는 [0, 1000]입니다.
public int MaxDiff { get; set; }
부동산 가치
Examples
이 예제는 다양한 옵션을 사용하여 BMP 이미지를 GIF 형식으로 저장하는 방법을 보여줍니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(1000, 1000))
{
// Fill the entire image with the blue-yellow gradient.
Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
new Aspose.Imaging.Point(0, 0),
new Aspose.Imaging.Point(bmpImage.Width, bmpImage.Height),
Aspose.Imaging.Color.Blue,
Aspose.Imaging.Color.Yellow);
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(bmpImage);
graphics.FillRectangle(gradientBrush, bmpImage.Bounds);
Aspose.Imaging.ImageOptions.GifOptions saveOptions = new Aspose.Imaging.ImageOptions.GifOptions();
// The number of bits required to store a color, minus 1.
saveOptions.ColorResolution = 7;
// Palette correction means that whenever image is exported to GIF the source image colors will be analyzed
// in order to build the best matching palette (in case image Palette does not exist or not specified in the options)
saveOptions.DoPaletteCorrection = true;
// Load a GIF image in a progressive way.
// An interlaced GIF doesn't display its scanlines linearly from top to bottom, but instead reorders it
// so the content of the GIF becomes clear even before it finishes loading.
saveOptions.Interlaced = true;
// Save as a lossless GIF.
using (System.IO.Stream stream = System.IO.File.OpenWrite(dir + "output.gif"))
{
bmpImage.Save(stream, saveOptions);
System.Console.WriteLine("The size of the lossless GIF: {0} bytes.", stream.Length);
}
// Set the maximum allowed pixel difference. If greater than zero, lossy compression will be used.
// The recommended value for optimal lossy compression is 80. 30 is very light compression, 200 is heavy.
saveOptions.MaxDiff = 80;
// Save as a lossy GIF.
using (System.IO.Stream stream = System.IO.File.OpenWrite(dir + "output.lossy.gif"))
{
bmpImage.Save(stream, saveOptions);
System.Console.WriteLine("The size of the lossy GIF: {0} bytes.", stream.Length);
}
}
//The output may look like this:
//The size of the lossless GIF: 212816 bytes.
//The size of the lossy GIF: 89726 bytes.
PixelAspectRatio
GIF 픽셀 측면 비율을 얻거나 설정합니다.
public byte PixelAspectRatio { get; set; }
부동산 가치
Remarks
Pixel Aspect Ratio - 접근을 계산하는 데 사용되는 요소원본 이미지에서 픽셀의 측면 비율.필드의 값은 0이 아닙니다, 이 측면 비율의 접근그것은 공식에 따라 계산됩니다 :Aspect Ratio = (Pixel Aspect Ratio + 15) / 64Pixel Aspect의 비율은 픽셀의 비율로 정의됩니다.그것의 높이 위의 폭.이 필드의 가치 범위는4 : 1의 가장 넓은 픽셀에서 가장 높은 픽셀까지1 : 4 : 1 / 64의 증가.가치 :0 - 측면 비율 정보가 제공되지 않습니다.1..255 - 계산에 사용되는 값.