Image Lab — Help & Reference
Examples are pre-rendered from static/images/memory.jpg using src/helper.py. See the repo for more information.
Original

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).




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$




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








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%).


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.
