# boxToClip

**Kind:** Function

**Source:** [`atloria-monorepo/apps/screenshot-worker/src/app/screenshot/services/crop.service.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/apps/screenshot-worker/src/app/screenshot/services/crop.service.ts#L36)

Convert a percent box (0-100 of the natural image) into a Playwright clip rect
in PIXELS, framing the target with `padPct` of breathing room on every side and
clamped to the image bounds so the clip never runs off-canvas.

## Signature

```ts
function boxToClip(box: BoxPct, imgW: number, imgH: number, padPct): ClipRect
```

## Parameters

| Name | Type |
|---|---|
| `box` | `BoxPct` |
| `imgW` | `number` |
| `imgH` | `number` |
| `padPct` | `any` |

**Returns:** `ClipRect`
