Helma logo
helma.org » Home > Stories > Image.reduceColors()

Image.reduceColors()

Reduces the number of available colors (color depth) in an image.

Note: GIF images need a color depth of 256 colors maximum. Use this function with caution, generally.

Syntax
imageObject.reduceColors(Number)

Example
var img = new Image("http://helma.org/images/original.jpg");
res.write('<img src="/images/original.jpg">');

A picture showing two funny people

img.reduceColors(8);
img.saveAs("/www/images/processed.jpg");
res.write('<img src="/images/processed.jpg">');

A picture which was reduced to 8 colors


... comment


Page last modified on 2002-07-16 16:54 by tobi