---
title: "pixelGrid"
description: "The pixel grid of a dither: the layer inside it chopped into square cells of a given size."
group: "paint"
groupTitle: "Painting"
categoryId: "patterns"
categorySlug: "patterns"
categoryTitle: "Patterns & tiling"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/paint/patterns.ts#L1035"
---

# pixelGrid

The pixel grid of a dither: the layer inside it chopped into square cells of a given size.

```ts
pixelGrid(slots: {size: PropRef}): PixelGrid
```

Import `patterns` from `shaders/std` and use `patterns.pixelGrid`.

`size` is a prop in pixels of the authored frame, so the cell count stays the same when the canvas renders at a higher resolution. Build it once and pass the same grid to `quantise` and `ditherInks`.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `slots` | `{size: PropRef}` |  |

## Example

```ts
const grid = pixelGrid({size: p('pixelSize')})
```

## See also

- [`quantise`](/docs/primitives/patterns/quantise) — Reduces each grid cell of the layer inside to 0 or 1 using a dither pattern.
- [`ditherInks`](/docs/primitives/patterns/ditherinks) — A dither filter: colors the 0/1 levels from `quantise`, either with two colors of your own or with darkened and brightened versions of the layer's own pixels.

## Used by

[Dither](/docs/components/dither)