[VBScript]
Set ca = Server.CreateObject("ImageGlue7.Canvas")
ca.DrawFile Server.MapPath("main.jpg"), ""
ca.ReduceColors "adaptive", 8, True
ca.SaveAs Server.MapPath("main.gif"), ""
plt = ca.GetInfo("palette")
ca.Clear
ca.DrawFile Server.MapPath("sub.jpg"), ""
ca.ReduceColors plt, 0, True
ca.SaveAs Server.MapPath("sub.gif"), ""
First we draw our main image onto a canvas and reduce the number
of colors down to eight. We then save the image as a GIF and
extracts the palette from the image using the GetInfo function. To
apply the palette to another image we just use the ReduceColors
method and pass in the palette we want to use.
The main and sub images are shown below.
main.jpg
sub.jpg
The output GIF images are shown below. Notice that both images
use the same colors - chosen from the main image.
main.gif
.
sub.gif
|