---
title: "SVG Image Element: How to Add Pictures Inside an SVG"
slug: "svg-image-element"
description: "Use the SVG image element to place PNG, JPG or SVG pictures inside a graphic. Covers href, sizing, cropping, shaped clips, embedding and missing images."
primaryKeyword: "svg image"
secondaryKeywords: []
relatedTools:
  - "/svg-code-to-image"
  - "/svg-viewer"
  - "/svg-compressor"
date: "2026-11-27"
author: "MintConvert Team"
---

# SVG Image Element: How to Add Pictures Inside an SVG

Shapes and text aren't the only things an SVG can hold. With the `<image>` element, you can place a photo inside a badge, put a screenshot under labels or crop a portrait into a circle.

This isn't the same as tracing. The picture stays a picture: a PNG or JPG is still made of pixels. [Tracing](/blog/how-to-make-an-svg-file) turns pixels into vector shapes.

## Basic syntax

```svg
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300">
  <image href="photo.jpg" x="0" y="0" width="400" height="300" />
</svg>
```

| Attribute | Purpose |
|---|---|
| `href` | Address of the picture, or a data URL |
| `x`, `y` | Position of the top-left corner |
| `width`, `height` | Size of the rectangle for the picture. Set both for predictable results |
| `preserveAspectRatio` | How the picture fits that rectangle |

According to [MDN's element reference](https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/image), SVG software must support JPEG, PNG and SVG. Older files may use `xlink:href`, which is deprecated in favor of `href`. Some older software may still expect it.

Inside HTML, use `<image>` only within an `<svg>`. For an ordinary picture on a page, use `<img>`.

## Fit or crop the picture

| Value | Result |
|---|---|
| `xMidYMid meet` | Shows the whole picture, centered. This is the usual default |
| `xMidYMid slice` | Fills the rectangle and crops the overflow |
| `none` | Stretches the picture to fill the rectangle |

These examples describe PNG and JPG pictures. A referenced SVG has some different sizing rules, so test it separately.

## Crop a picture into a circle

```svg
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200">
  <defs>
    <clipPath id="avatar">
      <circle cx="100" cy="100" r="90" />
    </clipPath>
  </defs>
  <image href="portrait.jpg" width="200" height="200"
         preserveAspectRatio="xMidYMid slice" clip-path="url(#avatar)" />
</svg>
```

Not every application supports clipping paths. Cutting software is one place to check, as explained in our [Cricut file guide](/blog/svg-files-for-cricut).

## Linked or embedded?

A **linked** picture stays in a separate file. An **embedded** picture is written into the markup as a data URL:

```xml
<image href="data:image/png;base64,PASTE_BASE64_HERE" width="400" height="300" />
```

Replace the placeholder with your picture's Base64 data, and match the media type to its format.

| | Linked | Embedded |
|---|---|---|
| Travels as one file | No | Yes |
| SVG file size | Smaller | Larger |
| Replacing the picture | Easy | Requires editing the markup |
| Works when the SVG is used as an image | External picture isn't loaded | Data URL can be used |

That last row catches many people. A linked picture may appear in inline SVG, then vanish when the same graphic is loaded through `<img>` or as a CSS background. Browsers [restrict external resources in that mode](https://developer.mozilla.org/en-US/docs/Web/SVG/Guides/SVG_as_an_image).

## Why is my picture missing?

- **Wrong path:** relative addresses are resolved from a base location, so check where the file and picture are.
- **No size:** add `width` and `height`.
- **External link in image mode:** embed the picture.
- **Outside the `viewBox`:** check `x`, `y` and the dimensions.
- **Covered:** elements written later are painted on top. See [how SVG markup is structured](/blog/svg-document-structure).

## Check and export your file

Open the graphic in an [SVG viewer](/svg-viewer), which can point out external links. To get a flat image from your markup, embed the pictures first, then use the [code to image tool](/svg-code-to-image). If the file feels heavy, resize the source picture before embedding it. An [SVG compressor](/svg-compressor) can trim markup, but don't expect it to do the work of resizing a large embedded photo.

## Frequently asked questions

### Does placing a PNG in SVG make it scalable?

No. The surrounding shapes scale cleanly, but the PNG still has a fixed number of pixels.

### Can I put text on top of the picture?

Yes. Write the `<text>` element after the `<image>` element.

### Can I use one SVG inside another?

Yes, you can reference it with `<image>`. It's treated as an image, so it isn't interactive and its external resources aren't loaded.

## Key takeaways

Set `href`, `width` and `height`, then choose `meet`, `slice` or `none`. Embed pictures when your graphic must travel as one file or be displayed as an image.