# Reduce Color Palette

img-gtry-red.dyn

20KB

Text

imgDim = Image.Dimensions(img);

pxlWdt = imgDim["width"]/10;

pxlHgt = imgDim["height"]/10;

pxlClr = Image.Pixels(img,pxlWdt,pxlHgt);

r1 = [0,255,0,0,255];

g1 = [0,0,255,0,255];

b1 = [0,0,0,255,255];

c1 = Color.ByARGB(255,r1,g1,b1);

r2 = pxlClr.Red;

g2 = pxlClr.Green;

b2 = pxlClr.Blue;

k1 = Math.Sqrt(Math.Pow((r1-r2<1><2>),2)

+Math.Pow((g1-g2<1><2>),2)+

Math.Pow((b1-b2<1><2>),2));

c2 = List.SortByKey(c1,k1<1><2>)["sorted list"];

c3 = List.FirstItem(c2<1><2>);

i2 = Image.FromPixels(c3);

ReduceColorPalette.dyn

29KB

Text

Last modified 2yr ago