Article ID: 318343 - View products that this article applies to.
This article was previously published under Q318343
This article references the following .NET Framework Class Library namespaces:
A GIF image file that is created by the GDI+ classes or by the System.Drawing classes is always saved using an 8 bits-per-pixel (bpp) image. This occurs because the encoder in the GIF codec that ships with GDI+ version 1.0 processes only 8-bpp Bitmaps or Images.
Although GDI+ 1.0 and the .NET Framework can work with Bitmap image objects in several different pixel formats, the GIF codec that is used with the Bitmap.Save() method can encode only the 8 bits-per-pixel format.
The GIF encoder is capable of processing both 8-bpp and 32-bpp images. When the GIF encoder receives a request to save a 32-bpp image, the GIF encloder converts the image to 8 bpp by half-toning the image. If the bitmap's pixel format is not the GIF encoder-supported 32-bpp or 8-bpp format, the Save() method converts the image to 32 bpp so that the GIF encoder can convert the image to the 8-bpp format before encoding. Thus, the GIF encoder always processes an 8-bpp format.
This may be unexpected in these ways:
GIF Files with Less Than 256 colorsTo create GIF files containing less than 256 colors, use an 8-bpp Bitmap object, but reduce the size of the palette and set the pixel indexes appropriately.
To save a monochrome GIF image file, follow these steps:
For additional information about saving a GIF with a new color table, click the article number below to view the article in the Microsoft Knowledge Base:
(https://support.microsoft.com/kb/315780/EN-US/ )HOWTO: Save a GIF File with a New Color Table By Using GDIplus
Third-party LicenseMicrosoft has obtained a license from Unisys to use the GIF file format and other LZW technologies that are covered by the Unisys-owned U.S. and foreign patents in a number of Microsoft products. However, this license does not extend to third-party developers who use Microsoft development products or toolkits to develop applications. As a third-party developer, you need to determine whether you need to obtain a license from Unisys to use the GIF format or the LZW technologies.
For additional information about LZW licenses and GIF, click the article number below to view the article in the Microsoft Knowledge Base:
(https://support.microsoft.com/kb/193543/EN-US/ )INFO: Unisys GIF and LZW Technology License Information
GIF DefinedGraphics Interchange Format (GIF) is a stream-capable image file format that was created by CompuServe.
Article ID: 318343 - Last Review: February 12, 2007 - Revision: 3.2