# --image-selector

Source: https://zshot-cli.com/reference/flags/image/image-selector/
Markdown: https://zshot-cli.com/reference/flags/image/image-selector/index.md
Section: [Reference](https://zshot-cli.com/reference/) › [Flags](https://zshot-cli.com/reference/flags/) › [Image](https://zshot-cli.com/reference/flags/image/)
CLI: `--image-selector` · REST: [`image_selector`](https://zshot-cli.com/reference/server/api/schema/#image_selector)
Value: `SELECTOR`

Crops the image to the element matching this CSS selector. The element's size will determine the output size, which [`--image-width`](/reference/flags/image/image-width) and [`--image-height`](/reference/flags/image/image-height) override. An invalid or selector that matches nothing will cause an error.

## Example

**CLI**

```sh
zshot -f main.png \
  --image-selector "main" \
  https://zshot-cli.com/example_assets/gazette/
```

**JSON** — `POST /` body for the [API](/reference/server/api), Pro license

```json
{
  "url": "https://zshot-cli.com/example_assets/gazette/",
  "output_type": "png",
  "image_selector": "main"
}
```

**curl**

```sh
curl -X POST http://127.0.0.1:3000/ \
  -H "Content-Type: application/json" \
  -d '{"url":"https://zshot-cli.com/example_assets/gazette/","output_type":"png","image_selector":"main"}' \
  -o main.png
```

## Related

Flags:

- [`--image-width`](https://zshot-cli.com/reference/flags/image/image-width/)
- [`--image-height`](https://zshot-cli.com/reference/flags/image/image-height/)
- [`--full-page`](https://zshot-cli.com/reference/flags/browser/full-page/)
- [`--video-selector`](https://zshot-cli.com/reference/flags/video/video-selector/)

Topics:

- [Exit Codes](https://zshot-cli.com/reference/exit_codes/)
- [CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors)

## Navigation

- [Examples](https://zshot-cli.com/examples/)
- [Download](https://zshot-cli.com/download/)
- [Purchase](https://zshot-cli.com/purchase/)
- [Reference](https://zshot-cli.com/reference/)
  - [Formats](https://zshot-cli.com/reference/formats/)
  - [Flags](https://zshot-cli.com/reference/flags/)
    - [Common](https://zshot-cli.com/reference/flags/common/)
    - [Agents](https://zshot-cli.com/reference/flags/agents/)
    - [Archive](https://zshot-cli.com/reference/flags/archive/)
    - [Browser](https://zshot-cli.com/reference/flags/browser/)
    - [Diagnostics](https://zshot-cli.com/reference/flags/diagnostics/)
    - [Document](https://zshot-cli.com/reference/flags/document/)
    - [Image](https://zshot-cli.com/reference/flags/image/)
      - [--bmp-pixel-format](https://zshot-cli.com/reference/flags/image/bmp-pixel-format/)
      - [--image-duration](https://zshot-cli.com/reference/flags/image/image-duration/)
      - [--image-framerate](https://zshot-cli.com/reference/flags/image/image-framerate/)
      - [--image-height](https://zshot-cli.com/reference/flags/image/image-height/)
      - **--image-selector**
      - [--image-width](https://zshot-cli.com/reference/flags/image/image-width/)
    - [Navigator](https://zshot-cli.com/reference/flags/navigator/)
    - [Security](https://zshot-cli.com/reference/flags/security/)
    - [Server](https://zshot-cli.com/reference/flags/server/)
    - [Video](https://zshot-cli.com/reference/flags/video/)
  - [Agents](https://zshot-cli.com/reference/agents/)
  - [Configuration](https://zshot-cli.com/reference/configuration/)
  - [Crawling](https://zshot-cli.com/reference/crawling/)
  - [Docker](https://zshot-cli.com/reference/docker/)
  - [Exit Codes](https://zshot-cli.com/reference/exit_codes/)
  - [Linux](https://zshot-cli.com/reference/linux/)
  - [LLM Connections](https://zshot-cli.com/reference/llm_connections/)
  - [LLM Formatting](https://zshot-cli.com/reference/llm_formatting/)
  - [Local Inputs](https://zshot-cli.com/reference/inputs/)
  - [Navigator](https://zshot-cli.com/reference/navigator/)
  - [Security](https://zshot-cli.com/reference/security/)
  - [Server](https://zshot-cli.com/reference/server/)
  - [Shell completions](https://zshot-cli.com/reference/shell_completions/)
  - [Storage](https://zshot-cli.com/reference/storage/)
  - [Timeouts](https://zshot-cli.com/reference/timeouts/)
  - [Web Bot Auth](https://zshot-cli.com/reference/web_bot_auth/)
- [Support](https://zshot-cli.com/support/)
- [Changelog](https://zshot-cli.com/changelog/)

Site index: https://zshot-cli.com/llms.txt

