![]() |
|
ImageExtensionsSaveAsGif Method (Image, Stream, Boolean) | KGy SOFT Drawing Libraries Help |
Saves the specified image as a GIF image.
See the Remarks section for the differences compared to the Image.Save(Stream,ImageFormat) method.
See the Remarks section for the differences compared to the Image.Save(Stream,ImageFormat) method.
Namespace: KGySoft.Drawing
Assembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 4.6.0
Syntax
public static void SaveAsGif( this Image image, Stream stream, bool allowDithering = false )
<ExtensionAttribute> Public Shared Sub SaveAsGif ( image As Image, stream As Stream, Optional allowDithering As Boolean = false )
public: [ExtensionAttribute] static void SaveAsGif( Image^ image, Stream^ stream, bool allowDithering = false )
[<ExtensionAttribute>] static member SaveAsGif : image : Image * stream : Stream * ?allowDithering : bool (* Defaults: let _allowDithering = defaultArg allowDithering false *) -> unit
Parameters
- image
- Type: System.DrawingImage
The image to save. If image contains multiple images other than animated GIF frames, then only the current image will be saved. - stream
- Type: System.IOStream
The stream to save the image into. - allowDithering (Optional)
- Type: SystemBoolean
to allow dithering high color images using a fix palette; otherwise, . 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).Remarks
When an image is saved by the Image.Save(Stream,ImageFormat) method using the GIF image format, then the original palette of an indexed source image and transparency can be lost in many cases. Unless the source image is already a 8 bpp one, the built-in encoder will use a fixed palette and dithers the image, while transparency will be lost.
This method preserves transparency of fully transparent pixels even if allowDithering is .
See Also