---
title: Images
description: Add images to your docs with markdown syntax, dimension controls, captions, and light/dark mode support.
---

Jamdesk renders images with rounded corners and consistent spacing. Drop files into your `/images` directory and reference them with standard markdown.

## Standard Markdown

Use the familiar `![alt](path)` syntax:

```markdown
![API response showing user data in JSON format](/images/tabs-preview.webp)
```

![API response showing user data in JSON format](/images/tabs-preview.webp)

Paths start from your project root. An image at `your-docs/images/screenshot.webp` is referenced as `/images/screenshot.webp`.

## Image Dimensions

Append `=WIDTHxHEIGHT` after the image URL (separated by a space) to control sizing:

```markdown
![Dashboard overview](/images/tabs-preview.webp =400x300)
```

Set only one dimension and the other scales proportionally:

```markdown
![Wide banner](/images/tabs-preview.webp =800x)
![Tall graphic](/images/tabs-preview.webp =x200)
```

This is useful when you want a consistent column of screenshots at the same width, or need to shrink a high-resolution image to a reasonable display size.

## Captions

Wrap an image in the `<Frame>` component to add a border and a caption below it:

```mdx
<Frame caption="Dashboard overview showing project statistics">
  ![Dashboard](/images/tabs-preview.webp)
</Frame>
```

<Frame caption="Example of a framed image with caption">
  ![Jamdesk](/images/jd-blueprint-transparent.webp)

</Frame>

`Frame` draws a subtle border around the image and places the caption text underneath. It works with any content inside it, not just images.

## Light/Dark Mode

Docs sites often need different image variants for each color scheme -- a logo on a white background looks wrong in dark mode.

### The `srcDark` attribute

The simplest approach. Jamdesk swaps the image source based on the active theme:

```mdx
<img
  src="/images/logo-light.webp"
  srcDark="/images/logo-dark.webp"
  alt="Company logo"
/>
```

The browser loads only the image that matches the current color scheme.

### The HTML `<picture>` element

If you need standard HTML that works outside Jamdesk too, use `<picture>` with a media query:

```mdx
<picture>
  <source srcset="/images/logo-dark.webp" media="(prefers-color-scheme: dark)" />
  <img src="/images/logo-light.webp" alt="Company logo" />
</picture>
```

The `<picture>` approach respects the operating system's color scheme setting. The `srcDark` attribute responds to Jamdesk's theme toggle instead, which is usually what you want for docs.

## Supported Formats

| Format | Best for | Notes |
|--------|----------|-------|
| PNG | Screenshots, UI captures | Lossless quality, supports transparency. Larger files. |
| JPEG | Photographs | Good compression, no transparency support. |
| SVG | Icons, diagrams, logos | Vector format -- scales to any size with zero quality loss. Tiny file size. |
| GIF | Simple animations | Can get large fast. Consider short `.mp4` loops for anything over a few frames. |
| WebP | General purpose | Smaller than PNG and JPEG at comparable quality. Works in all modern browsers. |

<Tip>
WebP gives you the best size-to-quality ratio for most documentation images. If you need transparency, WebP handles that too -- no need for PNG.
</Tip>

## Best Practices

<AccordionGroup>
  <Accordion title="Write meaningful alt text" icon="universal-access">
    Alt text serves two purposes: screen readers use it for accessibility, and it shows up as a placeholder when the image fails to load. Describe what the image actually shows.

    ```markdown
    {/* Good -- says what's in the image */}
    ![API response showing user data in JSON format](/images/tabs-preview.webp)

    {/* Bad -- tells you nothing */}
    ![Screenshot](/images/tabs-preview.webp)
    ```

    For decorative images that don't add information (background patterns, dividers), use empty alt text: `![](/images/decoration.webp)`.
  </Accordion>

  <Accordion title="Keep file sizes small" icon="gauge-high">
    Heavy images slow page loads, especially on mobile connections. Target sizes:

    - **Screenshots/UI:** PNG or WebP, under 500KB
    - **Photos:** JPEG or WebP, under 200KB
    - **Icons and diagrams:** SVG whenever possible

    [Squoosh](https://squoosh.app) and [TinyPNG](https://tinypng.com) compress images without visible quality loss. Run screenshots through one of these before committing.

    Or let Jamdesk handle it at build time. Enable [automatic WebP conversion](/builds/image-optimization) in your `docs.json` and any PNG or JPG you commit gets optimized on each build.
  </Accordion>

  <Accordion title="Stick to consistent dimensions" icon="ruler-combined">
    Screenshots that jump between different widths look messy. Pick a standard capture width (1200px works well) and use it across your docs. Jamdesk scales images to fit the content area automatically, so consistent source dimensions produce consistent rendered results.
  </Accordion>
</AccordionGroup>

## File Organization

Group images into subdirectories that mirror your content structure. This keeps things findable as your docs grow:

```bash
your-docs/
├── images/
│   ├── getting-started/
│   │   ├── step-1.png
│   │   └── step-2.png
│   ├── api/
│   │   └── response.png
│   └── logo.svg
└── docs.json
```

Reference them with the full path from your project root:

```markdown
![GitHub repository access](/images/getting-started/step-1.png)
```

<Warning>
Avoid spaces in image filenames. Use hyphens instead: `api-response.webp`, not `api response.webp`.
</Warning>

## What's Next?

<Columns cols={3}>
  <Card title="YouTube Embeds" icon="youtube" href="/content/youtube">
    Embed YouTube videos and Shorts
  </Card>
  <Card title="Videos" icon="video" href="/content/videos">
    Local MP4 and WebM files
  </Card>
  <Card title="iFrames" icon="code" href="/content/iframes">
    Vimeo, CodePen, Figma, and more
  </Card>
</Columns>
