Skip to content

Today I learned

How do I measure whether a screen overlay is washing out my game's colours?

· updated #Game development

"The picture looks muddy" is hard to act on. Put a number on it: screenshot the same frame with the overlay on and off and compare the Hasler–Süsstrunk colourfulness of the area you suspect.

python
import numpy as np
from PIL import Image

def colourfulness(path, edge=0.15):
    img = np.asarray(Image.open(path).convert("RGB"), dtype=float)
    h, w, _ = img.shape
    m = np.zeros((h, w), bool)  # the band along the screen edges
    m[:int(h*edge)] = m[-int(h*edge):] = True
    m[:, :int(w*edge)] = m[:, -int(w*edge):] = True
    r, g, b = (img[..., i][m] for i in range(3))
    rg, yb = r - g, 0.5 * (r + g) - b
    return np.hypot(rg.std(), yb.std()) + 0.3 * np.hypot(rg.mean(), yb.mean())

The paper's scale: 15 is slightly colourful, 33 moderately, 59 quite.

Hit this on a painted 2D game whose seasonal weather layer had a soft colour frame along the screen edges. The white winter frame at alpha 0.3 dropped edge colourfulness from 65 to 47; the particles on top (snow, rain, leaves) changed nothing. I removed the frame, kept the particles, and the edges now score the same with weather on or off.

Source: Hasler & Süsstrunk, Measuring Colourfulness in Natural Images

Share LinkedIn Post on X

Related notes

Newsletter

Occasional notes on engineering, game tech, and new tools — no spam, unsubscribe anytime.

Ravy

Engineering manager, founder, and software developer building web platforms, game systems, real-time services, and automation tools. 15 years of shipped work — currently at Gaijin.net.

Get in Touch

Building an MVP, shipping a game feature, or automating a team workflow? Open source or paid — let's talk.

Contact Me
© 2020-2026 XPLOIT FZE. All trademarks, names and logos belong to their respective copyright holders.