[Registered version only]

BuildPalette

The BuildPalette function rebuilds image palette in accordance with real image colors.

BuildPalette nImportantColors

Parameters

nImportantColors
Specifies the number of impotant colors in the image. These are first nImportantColors colors in the image palette. These palette entries will not be changed.

Remarks

This method reconstructs image palette and changes its entries except first nImportantColors colors. This function is very important if the read image colors do not match the colors declared by SetColor function callings.
Use this function once in your script just before calling GifImage function to improve your image quality, if you used some operations which can add other colors into the palette, like the following:

See too

CreateImage, SetColor
Example

<%@ Language=VBScript %>
<%
Response.ContentType="image/gif"
set obj=Server.CreateObject("shotgraph.image")
size=100
obj.CreateImage size,size,16
obj.SetColor 0,255,255,255
obj.SetColor 1,0,0,0
obj.SetColor 2,255,108,0
obj.SetBgColor 0
obj.FillRect 0,0,size-1,size-1

obj.SetTextAlign "TA_CENTER","TA_BASELINE"
obj.SetBkColor 0
obj.SetTextColor 1
obj.CreateFont "Arial",0,22,0,True,False,False,False
obj.TextOut size/2,24,"Text1"
obj.SetTextColor 2
obj.CreateFont "Arial",0,15,0,True,False,False,False
obj.TextOut size/2,size/2,"Text2"

obj.BuildPalette 3

img=obj.GifImage(-1,1,"")
Response.BinaryWrite(img)
%>
Results:
Without BuildPalette With BuildPalette