If you look closely at the colors used with a simple polygon graphic in Mathematica, they feather the colors at the edge to make for a nicer graphic, but I don't want that for my project. I want to control the number of total colors that will be used in the exported bitmap. How can I create a graphic of multiple different colored solid polygons and end with a final result that has that exact number of colors. For example:
image=Graphics[{Red, Triangle[{{0, 0}, {1, 0}, {0, 1}}],
Blue, Triangle[{{1, 0}, {2, 0}, {2, 1}}],
Green, Triangle[{{2, 1}, {2, 2}, {1, 2}}],
Yellow, Triangle[{{1, 2}, {0, 2}, {0, 1}}]}]
If you analyze the output from ImageData[image]
you can see shades of red, green, blue and yellow are used on the edges. Exporting this to a bitmap creates a file with many colors. I want to export this to a bitmap with exactly 5 colors: white, red, blue, green and yellow. I have played with EdgeForm
with no luck. Thanks!
ColorQuantize[Rasterize[image], 5]
to produce an image with exactly 5 colors. $\endgroup$