Skip to content
svgimage-quality

Image brightness and sharpness

Which images are too dark, washed out, blurry or duplicated?

Demo data · seed 20261101 · 60 rows · default settings · 640 × 360SVG, lightSVG, darkDemo CSV

How to read it

  1. Read each dot as one image: brightness across, sharpness up on a log scale.
  2. The shaded edges are too dark or too bright; dots under the dashed horizontal line are softer than the blur threshold.
  3. Colours give the method's flag, so you can open the flagged files in the table below the chart.
  1. Callout 1: The dark band: mean brightness below the threshold.
  2. Callout 2: The blur line: sharpness below it is flagged.
  3. Callout 3: The bright band: washed-out images.

Watch out

  • Plain images (sky, walls, product shots on white) have little detail and score as blurry without being out of focus.
  • Sharpness falls with image size, so compare images of similar size.

Defaults

Dark below
0.15
Brightness threshold drawn on the left; the method's own setting is sent with the result.
Range 0 to 1, step 0.05
Bright above
0.85
Brightness threshold drawn on the right.
Range 0 to 1, step 0.05
Blurry below
100
Sharpness threshold drawn as the horizontal line.
Range 0 to 100,000, step 10

Pinned in the code

  • Draws what the Python or R engine computed; the chart computes nothing statistical.
  • Brightness is the mean ITU-R BT.601 luma on 0–1; sharpness is the variance of the 4-neighbour Laplacian, on a log10(1 + v) axis so small and large values both show.
  • Flags follow the method's order: Duplicate first, then Dark, Bright and Blurry; an image gets one flag.
  • Sharpness falls with image size and with plain content (sky, walls): a low value is a reason to look, not proof of blur.
# Image brightness and sharpness — Codesplash Chart Lab (recipe "image-quality")
# controls: dark=0.15, bright=0.85, blur=100
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

try:
    import codesplash as cs  # optional: the app's chart theme
except ImportError:
    cs = None
if cs:
    cs.use_codesplash(dark=False)
PALETTE = cs.palette(dark=False)["categorical"] if cs else plt.rcParams["axes.prop_cycle"].by_key()["color"]
# non-colour encodings per series (same table as the app: series are never told apart by colour alone)
SERIES_MARKERS = ["o", "s", "^", "D", "P", "*", "2", "v"]

df = pd.read_csv("image-quality-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
df["flag"] = pd.Categorical(df["flag"].astype("string"), categories=["OK", "Dark", "Bright", "Blurry", "Duplicate"])

_tokens = cs.palette(dark=False) if cs else {}
SEQ = _tokens.get("sequential", ["#eff6fd", "#1a469d"])  # sequential ramp (low → high)
DIV = _tokens.get("diverging", ["#c13e2e", "#f3f5f8", "#0859ac"])  # negative, midpoint, positive
REF = _tokens.get("reference", "#4e5661")
GREY = _tokens.get("dim", "#ced1d6")
B = "brightness"
S = "sharpness"
FLAG = "flag"
LABEL = "file"
DARK, BRIGHT, BLUR = 0.15, 0.85, 100
FLAGS = ["OK", "Dark", "Bright", "Blurry", "Duplicate"]
d = df.dropna(subset=[B, S])
flags = d[FLAG].astype(str) if FLAG else pd.Series("OK", index=d.index)
order = [f for f in FLAGS if (flags == f).any()] + sorted(set(flags) - set(FLAGS))
fig, ax = plt.subplots(figsize=(7, 5))
if LABEL:  # name the flagged files
    for _, r in d[flags != "OK"].iterrows():
        ax.annotate(str(r[LABEL]), (r[B], 1 + r[S]), xytext=(4, 3), textcoords="offset points", fontsize=7)
for i, f in enumerate(order):
    m = flags == f
    ax.scatter(d.loc[m, B], 1 + d.loc[m, S], s=24, color=GREY if f == "OK" else PALETTE[(i - ("OK" in order)) % len(PALETTE)], marker=SERIES_MARKERS[i % 8], label=f, alpha=0.8)  # marker shape per flag, as in the app
ax.set_yscale("log")  # the app plots log10(1 + sharpness)
for x in (DARK, BRIGHT):
    ax.axvline(x, color=REF, linestyle="--", linewidth=0.9)
ax.axhline(1 + BLUR, color=REF, linestyle="--", linewidth=0.9)
ax.set_xlim(0, 1)
ax.set_xlabel("brightness (mean luma, 0–1)")
ax.set_ylabel("1 + sharpness (variance of the Laplacian)")
ax.legend(fontsize=8)
ax.set_title("Brightness and sharpness of each image")
plt.show()

Needs pandas, numpy, matplotlib · reads image-quality-demo.csv · app theme from the optional codesplash helper