Microsoft Download Center Archive

.NET Color Quantization

  • Published:
  • Version: 1.0
  • Product: Developer Tools
  • Category: SDK
  • Language: English

Describes how to quantize dynamically generated images for use with ASP.NET

Most web sites include some form of graphics, such as the banner heading on the MSDN web site, and the thumbnail images available for the list of recent headlines. All of these images are static – they are generated by a member of the web team, recolored to suit the requirements of the web site, and stored on disk to be used as appropriate.
With ASP.Net it is also possible to create dynamic images – images which are created during the processing of the current web request. Some uses for this would be personalization of a site, or generation of images which conform to a particular visual style, without requiring the services of a web designer.
The generation of images is relatively simple – create a surface to draw on, render the appropriate image, and save this to the ASP.Net response stream to be returned to the user.
The only problem with this scenario is the resulting image – GDI+ will by default utilize a web safe palette when converting a bitmap to an image suitable for a web page (such as GIF/Jpeg), and so the resulting image will be of poor quality and may contain various stray colors from the color reduction algorithm used. This conversion to a web safe palette occurs before the image is converted to the output type (such as GIF/Jpeg), so even though the output type may support many colors, the image will be generated to use colors from the web safe palette.

The attached download provides two examples of how quantization can be used to recolor an image.

Files

Status: Deleted

This download is no longer available on microsoft.com. The downloads below are archives provided by the Internet Archive Wayback Machine from the Microsoft Download Center prior to May 2014.

No files found

File sizes and hashes are retrieved from the Wayback Machine’s indexes. They may not match the latest versions of files hosted on Microsoft servers.

System Requirements

Operating Systems: Windows 2000, Windows Server 2003, Windows XP

.NET Framework version 1.0 or 1.1
ASP.NET
Visual Studio.NET

Installation Instructions

To setup this example on your PC, please do the following.

(1) Copy all files onto your hard drive. The attached .exe is a self extracting .zip which includes all files necessary for this example.
(2) Publish the 'Quantize' directory from your web server. It should be published as http://localhost/quantize.

Then open the solution file, rebuild and run.

This page was generated from a snapshot of the Microsoft Download Center made on .
FamilyId: cb9a0bc8-c96b-4c3e-9652-df609352fa89