Skip to content
svgimage-sizes

Image pixel sizes

Are the images a consistent size and shape, or a mix of resolutions and orientations?

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

How to read it

  1. Read each dot as one image placed by its width and height in pixels; both axes are logarithmic and share one scale.
  2. Dashed rays mark common shapes: on the diagonal images are square, below it landscape, above it portrait.
  3. Clusters of dots show the handful of resolutions in the collection; scattered dots show a mix.
  1. Callout 1: The 1:1 ray: square images.
  2. Callout 2: A landscape cluster on the 4:3 ray.
  3. Callout 3: Portrait images above the diagonal.

Watch out

  • Sizes are as stored: a phone photo with a rotation flag can land on the mirrored ray.
  • Resizing images to one size for a model hides this spread; check it before you resize.

Defaults

No settings: the chart draws one way.

Pinned in the code

  • Draws what the Python or R engine computed; the chart computes nothing statistical.
  • Both axes share one log domain, so equal shapes lie on the same ray and the 1:1 ray is the diagonal; landscape images fall below it, portrait above.
  • Sizes are as stored: EXIF orientation is not applied, so a rotated photo can appear on the mirrored ray.
# Image pixel sizes — Codesplash Chart Lab (recipe "image-sizes")
# controls: defaults
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"]

df = pd.read_csv("image-sizes-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
df["format"] = pd.Categorical(df["format"].astype("string"), categories=["JPEG", "PNG"])

_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")
def levels_of(s):
    """Declared level order (categoricals), else order of first appearance."""
    if isinstance(s.dtype, pd.CategoricalDtype):
        return [v for v in s.cat.categories if (s == v).any()]
    return list(dict.fromkeys(s.dropna().astype(str)))
W = "width"
H = "height"
G = "format"
RATIOS = {"1:1": 1, "4:3": 4 / 3, "3:2": 3 / 2, "16:9": 16 / 9, "3:4": 3 / 4, "2:3": 2 / 3, "9:16": 9 / 16}
d = df[(df[W] > 0) & (df[H] > 0)]
lo, hi = max(1, min(d[W].min(), d[H].min()) / 1.5), max(d[W].max(), d[H].max()) * 1.5  # one shared log domain
fig, ax = plt.subplots(figsize=(6.5, 6))
for name, r in RATIOS.items():
    w0, w1 = max(lo, lo * r), min(hi, hi * r)
    if w1 > w0:
        ax.plot([w0, w1], [w0 / r, w1 / r], color=REF, linestyle="--", linewidth=0.8, alpha=0.5 if r == 1 else 0.3)
        ax.annotate(name, (w1, w1 / r), fontsize=7, ha="right", va="top", color=REF)
groups = levels_of(d[G]) if G else [None]
for i, k in enumerate(groups):
    m = (d[G].astype(str) == str(k)) if G else np.ones(len(d), bool)
    ax.scatter(d.loc[m, W], d.loc[m, H], s=24, color=PALETTE[i % len(PALETTE)], alpha=0.72, label=k)
ax.set_xscale("log")
ax.set_yscale("log")
ax.set_xlim(lo, hi)
ax.set_ylim(lo, hi)
ax.set_xlabel("width (px)")
ax.set_ylabel("height (px)")
if G:
    ax.legend(title=G, fontsize=8)
ax.set_title("Pixel size of each image")
plt.show()

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