wobblyhead hg > minor_monsters
diff tools/images.py @ 6:910b26feca76
full game flow
| author | ark |
|---|---|
| date | 2026-10-19 01:05 +0200 |
| parents | 5492efd60e2c |
| children |
line wrap: on
line diff
--- a/tools/images.py Sun Oct 18 22:50:24 2026 +0200 +++ b/tools/images.py Mon Oct 19 01:05:29 2026 +0200 @@ -31,6 +31,19 @@ return Image.merge("RGBA", (r, g, b, a)) +def recolour(im, hue): + """ + return a copy with every pixel's hue set to hue (degrees), saturation, + brightness and alpha unchanged. grey and black pixels stay as they are. + """ + a = im.getchannel("A") + h, s, v = im.convert("RGB").convert("HSV").split() + h = h.point(lambda _: round(hue / 360 * 255)) + out = Image.merge("HSV", (h, s, v)).convert("RGBA") + out.putalpha(a) + return out + + def split_strip(im): """ split a strip of drawings side by side at columns without pencil.
