[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]
Check out Janggi (Korean Chess), our featured variant for December, 2024.
Check out Janggi (Korean Chess), our featured variant for December, 2024.
If you are talking about bitmaps of piece that were rendered from some higher resolution (or vector image) using anti-aliasing on a white background, the pieces all having black outlines, then indeed, replacing the grey with black, and using the bitwise complement of the grey-scale value as alpha channel would mix in as much background as the original image would have mixed in white. Additional condition is that the image would not contain any internal grey pixels. This could be problematic with pieces that had purely white filling; the algorithm would treat the white filling the same as the exterior, and make the entire piece transparent.
This could be avoided by using a flood-fill-like algorithm, which only treats pixels which neighbored other pixels that were changed. And then start in a corner pixel.
Old bitmap images might not have anti-aliasing, though. These would just have a ragged boundary between an absolutely black outline and a uniform background of another color. (The original Alfaeries are like that.)