Image laboratory
One pixel and eight neighbors
Choose a filter, then a pixel in the source. The result is on the right; below it is the exact calculation for one color channel. The sample is drawn here as a small grid of pixels.
Experiment
Choosing filters and pixels and processing files requires JavaScript. The example below also works without it.
Averaging nine neighbors smooths sharp transitions.
Choose a cell, use the arrow keys, or enter the column and row below. Coordinates start at 1.
Pixel calculation
- Sum of products
- Divide by
- Round and clamp to 0…255
The R, G and B channels are calculated separately.
Example: blurring a uniform area
If all nine red-channel values are 90, their sum is 810. Divide by 9 to get 90. The uniform area does not change.
(9 × 90) ÷ 9 = 90
Your image
Choose a PNG, JPEG or static WebP. Your file is not sent to a server: the browser resizes it to at most 512 pixels on its longest side and applies the selected filter.
Up to 5 MiB, at most 4096 pixels per side and 4 million pixels in total. Animation and SVG are not supported. Resize larger photos in an editor first.
Local processing only. Your selected file and result are not saved after you close the page.
Calculation rules
- At an image boundary, use the nearest existing pixel: repeat the outermost rows and columns.
- First sum all signed products and divide by the filter divisor. Then round to the nearest integer (ties upwards) and clamp to 0…255.
- Calculations use 8-bit encoded RGB values after the browser decodes the file. This demonstrates a filter; it is not physically accurate light mixing in linear color space.
- Transparency is flattened onto white before processing. The output is opaque. Source color and orientation can depend on the browser's decoder.