← Back to Editor

Image Lab — Help & Reference

Examples are pre-rendered from static/images/memory.jpg using src/helper.py. See the repo for more information.

Original

original image

Basic Transforms

Rotate ±90° uses orthogonal rotation (no resampling blur). Arbitrary rotation uses bicubic resampling.

Flip H/V mirrors pixels about the vertical or horizontal axis.

Resize uses interpolation kernels: Nearest, Bilinear, Bicubic, Lanczos (windowed sinc).

Resize Kernels

Bilinear: $I'(x)= \\sum w_i I_i$ (linear weights)

Bicubic: cubic weighting in 4×4 neighborhood.

Lanczos: $\\text{Lanczos}_a(x)=\\text{sinc}(x)\\,\\text{sinc}(x/a)$ for $|x|

rotate +90
Rotate +90° — orthogonal rotation, expand canvas.
flip h
Flip Horizontal — mirror across vertical axis.
resize 50%
Resize 50% — contain to 50% on longest edge, Lanczos.
resize 200%
Resize 200% — Lanczos upsample (high quality).

Tone & Color Adjustments

  • Brightness: $I' = a\\,I$
  • Contrast: $I' = a\\,(I - 128) + 128$
  • Saturation: scales chroma (implemented via Pillow’s Color enhancer)
  • Gamma: $I' = 255\\,(I/255)^{1/\\gamma}$

Example Parameters

Brightness ×1.20, Contrast ×1.15, Saturation ×1.10, $\\gamma=0.9$

adjust bcs gamma
Adjust — B×1.20, C×1.15, S×1.10, $\\gamma=0.9$.
grayscale
Grayscale — luminance only.
sepia
Sepia — colorize grayscale: low=(20,10,0), high=(255,240,192).
invert
Invert — $I' = 255 - I$.

Filters

Gaussian Blur (radius $\\sigma$):

$G(x,y) = \\dfrac{1}{2\\pi\\sigma^2} e^{-\\frac{x^2+y^2}{2\\sigma^2}}$

Median (odd window size): replaces each pixel with the median of its neighborhood.

Unsharp Mask: $I' = I + k\\,(I - G_{\\sigma}(I))$

Sobel Edges: $|\\nabla I| = \\sqrt{(I * S_x)^2 + (I * S_y)^2}$

Emboss: directional high-pass convolution (relief effect).

Posterize: quantize to $b$ bits/channel ($2^b$ levels).

Pixelate: downsample to blocks, upsample with nearest neighbor.

Parameters Used in Examples

  • Gaussian: $\\sigma=1.5$ and $\\sigma=3.0$
  • Median: size 3×3
  • Unsharp: radius 2.0, amount 150%, threshold 3
  • Posterize: 4 bits/channel
  • Pixelate: block size 8 px
gaussian 1.5
Gaussian blur — $\\sigma=1.5$ px.
gaussian 3
Gaussian blur — $\\sigma=3.0$ px.
median 3
Median — size 3×3.
unsharp
Unsharp Mask — radius 2.0, amount 150%, threshold 3.
edges
Edges — Sobel magnitude.
emboss
Emboss — directional high-pass.
posterize 4
Posterize — 4 bits/channel (16 levels).
pixelate 8
Pixelate — block size 8 px (nearest upsample).

Histogram Equalization

Compute luminance CDF $C(i)=\\sum_{j\\le i} h(j)$ and map with

$I' = \\text{round}\\left( \\dfrac{C(I)-C_{\\min}}{(W\\cdot H) - C_{\\min}} \\cdot (L-1) \\right)$

spreading intensities across levels $L$.

Background Removal

Estimate border mean color $\\mu$; remove pixels with

$\\lVert I(x)-\\mu \\rVert_2 < T$

where $T$ is set by tolerance (here: 18%).

hist eq
Histogram Equalization — luminance channel equalized.
bg remove
Background Removal — tolerance 18%, border-mean color keying (RGBA output).

Seam Carving

Compute an energy map, e.g. gradient magnitude $E=|\\nabla I|$, then find a connected seam of minimum cumulative energy with dynamic programming:

$M(i,j) = E(i,j) + \\min\\{ M(i-1,j-1),\\ M(i-1,j),\\ M(i-1,j+1) \\}$

Remove (or insert) low-energy seams to change dimensions while preserving salient content.

Backend

Using backend: seam-carving.

seam carve
Seam Carve — target width = 70% of original (width-first, backward energy).