ImageExtensionsSaveAsGif(Image, String, IQuantizer, IDitherer) Method

Saves the specified image to the specified file using the built-in GIF encoder if available in the current operating system. Unlike the Save(Stream, ImageFormat) method, this one supports every PixelFormat.
See the Remarks section of the SaveAsGif(Image, Stream, IQuantizer, IDitherer) overload for details.

Definition

Namespace: KGySoft.Drawing
Assembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 8.1.0
C#
public static void SaveAsGif(
	this Image image,
	string fileName,
	IQuantizer? quantizer = null,
	IDitherer? ditherer = null
)

Parameters

image  Image
The image to save. If image contains multiple images other than animated GIF frames, then only the current image will be saved.
fileName  String
The name of the file to which to save the image. The directory of the specified path is created if it does not exist.
quantizer  IQuantizer  (Optional)
If image is a non-indexed one, then specifies the quantizer to be used to determine the colors of the saved image. If , then the target colors will be optimized for the actual colors in the image. This parameter is optional.
Default value: .
ditherer  IDitherer  (Optional)
If a quantization has to be performed can specifies the ditherer to be used. If , then no dithering will be performed. This parameter is optional.
Default value: .

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Image. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also