# Engrave image

Any image as a line engraving: parallel lines that bend with the picture's light so they wrap the form, swell with its shadows and cross hatch the darkest parts, in ink and paper from your tokens.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: Engrave image. A portrait cut as a line engraving. Relief bends the lines around the form; hover or focus shows the photo. Preview: https://chatcn.dev/preview/engrave-image-demo

## Installation

```bash
npx shadcn@latest add @chatcn-pro/engrave-image
```

## Usage

```tsx
import { EngraveImage } from "@/components/ui/chatcn/pro/engrave-image"

<EngraveImage src={image.url} alt={image.prompt} relief={0.6} aspectRatio="4:5" reveal />
```

Relief bends each line by the light under it, read through a blur one line wide, so the lines ride over a face instead of tracing every edge. Width reads the light at half a line, so detail survives. On a light ink the picture prints as white lines on a dark ground.

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `src`, `alt` | `string` | `alt` is required: it is the accessible name |
| `lines` | `number` | Lines across the height. Default one per 5 CSS px |
| `angle` | `number` | Line direction in degrees. Default 0, horizontal |
| `relief` | `number` | 0 to 1: how far the light bends the lines. Default 0.5 |
| `cross` | `boolean` | Cross hatch the deep shadows. Default true |
| `ink`, `paper` | `string` | Any CSS color or token. `paper` may be `transparent` |
| `contrast`, `brightness`, `threshold` | `number` | Defaults 1.1, 0 and 0.5 |
| `invert` | `boolean` | Lines stand for light instead of dark |
| `reveal` | `boolean` | Original on hover, keyboard focus, or press and hold on touch |
| `aspectRatio`, `width`, `height` |  | Set the frame before the image loads, so nothing shifts |
| `maxPixels` | `number` | Default 1.5 MP. Lower it for many tiles |
| `renderer` | `"auto" | "webgl" | "2d"` | Force a path |
| `onStatusChange` | `(status: "loading" | "ready" | "error") => void` |  |

## Keyboard

| Key | Action |
| --- | --- |
| `Tab` | With `reveal`, focus shows the original; leaving hides it |

## Accessibility

- The canvas is `aria-hidden`. The real `<img>` with your `alt` sits underneath and is what screen readers announce.
- Under `forced-colors: active` the effect hides and the plain image shows with system colors.
- Under `prefers-contrast: more` ink and paper snap to the text and canvas tokens and the lines get coarser, so they print solid.

## Motion

- The first frame fades in over 200 ms. Reveal crossfades over 150 ms; nothing moves or scales.
- Under reduced motion only these short fades remain.

Source: https://chatcn.dev/docs/components/engrave-image