Reduce Color Palette
img-gtry-red.dyn
20KB
Text
1
imgDim = Image.Dimensions(img);
2
pxlWdt = imgDim["width"]/10;
3
pxlHgt = imgDim["height"]/10;
4
5
pxlClr = Image.Pixels(img,pxlWdt,pxlHgt);
6
r1 = [0,255,0,0,255];
7
g1 = [0,0,255,0,255];
8
b1 = [0,0,0,255,255];
9
c1 = Color.ByARGB(255,r1,g1,b1);
10
r2 = pxlClr.Red;
11
g2 = pxlClr.Green;
12
b2 = pxlClr.Blue;
13
k1 = Math.Sqrt(Math.Pow((r1-r2<1><2>),2)
14
+Math.Pow((g1-g2<1><2>),2)+
15
Math.Pow((b1-b2<1><2>),2));
16
c2 = List.SortByKey(c1,k1<1><2>)["sorted list"];
17
c3 = List.FirstItem(c2<1><2>);
18
i2 = Image.FromPixels(c3);
Copied!
ReduceColorPalette.dyn
29KB
Text
Last modified 1yr ago
Copy link