# Using Sirv CDN with Nuxt

Take advantage of the simplicity of Nuxt Image and power of Sirv with the official [Nuxt/Image module](https://image.nuxt.com/providers/sirv). Your original Nuxt Image props will automatically translate to Sirv URL parameters.

Using an AI coding agent?

Install the [`image-optimization`](https://www.skills.sh/sirv/image-optimization-skill/image-optimization) skill, and your agent can set up Sirv images in your project. Ask in plain words, such as “Serve our product images from Sirv and make them load faster.” [See all 8 skills](/help/rest-api/sirv-skills-for-ai-agents/)

[Listed below](#full-list-of-options) are more than 100 options to scale, crop and apply watermarks, text and other effects. Try all the options in the [Image URL Builder](/help/image-api-wizard/).

## Live Nuxt demo

Play with the Nuxt Image live demo in your browser on [StackBlitz](https://stackblitz.com/edit/github-yissmf?file=pages%2Findex.vue) or [CodeSandbox](https://codesandbox.io/p/github/IgorVaryvoda/Nuxt-Image-Sirv-Provider/main?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clnubd4q00007206cls4bs7a3%2522%252C%2522sizes%2522%253A%255B60%252C40%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clnubd4q00003206c07crwwcb%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clnubd4q00005206cfwb5s589%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clnubd4q00006206cfg0xq704%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B52.49647209113799%252C47.50352790886201%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clnubd4q00003206c07crwwcb%2522%253A%257B%2522id%2522%253A%2522clnubd4q00003206c07crwwcb%2522%252C%2522activeTabId%2522%253A%2522cloh2musf004a206d6b8g9jd9%2522%252C%2522tabs%2522%253A%255B%257B%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fapp.vue%2522%252C%2522id%2522%253A%2522clnubgpjh00sj206cs5w7zmfe%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fpages%252Findex.vue%2522%252C%2522id%2522%253A%2522cloh2musf004a206d6b8g9jd9%2522%252C%2522mode%2522%253A%2522temporary%2522%257D%255D%257D%252C%2522clnubd4q00006206cfg0xq704%2522%253A%257B%2522id%2522%253A%2522clnubd4q00006206cfg0xq704%2522%252C%2522tabs%2522%253A%255B%257B%2522type%2522%253A%2522TASK_PORT%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522port%2522%253A3000%252C%2522id%2522%253A%2522clnubg5ew00n7206c1v3wl8zz%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522activeTabId%2522%253A%2522clnubg5ew00n7206c1v3wl8zz%2522%257D%252C%2522clnubd4q00005206cfwb5s589%2522%253A%257B%2522id%2522%253A%2522clnubd4q00005206cfwb5s589%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clnubd4q00004206cgdpzq1dz%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TERMINAL%2522%252C%2522shellId%2522%253A%2522clnwx6gzb0014eaix2w2g2m9j%2522%257D%252C%257B%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522id%2522%253A%2522clnubd63n005w206c1i5k4grp%2522%252C%2522mode%2522%253A%2522permanent%2522%257D%252C%257B%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522CSB_RUN_OUTSIDE_CONTAINER%253D1%2520devcontainer%2520templates%2520apply%2520--template-id%2520%255C%2522ghcr.io%252Fdevcontainers%252Ftemplates%252Ftypescript-node%255C%2522%2520--template-args%2520%27%257B%257D%27%2520--features%2520%27%255B%255D%27%2522%252C%2522id%2522%253A%2522clnubdot800ax206c22fcsetc%2522%252C%2522mode%2522%253A%2522permanent%2522%257D%255D%252C%2522activeTabId%2522%253A%2522clnubd63n005w206c1i5k4grp%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D).

Or you can check out a statically generated version [here](https://demo.sirv.com/code-demos/nuxt-image/).

## Getting started

1.  Install the @nuxt/image module by following the instructions [here](https://image.nuxt.com/get-started/installation).
2.  [Sign up](https://app.sirv.com/signup) for a Sirv account if you haven’t already, and grab your [account name](/help/getting-started/account-name-subdomain/) from the [settings page](https://app.sirv.com/settings/account).
3.  Add your base Sirv URL to your Nuxt config file:

```js
      image: {
        provider: 'sirv',
        sirv: {
          baseURL: 'https://youralias.sirv.com/'
        }
      }
```

4.  That’s it! Now you can enjoy the convenience of Nuxt Image and powerful image optimization and delivery options of Sirv.

## Usage

Sirv will automatically pick up standard Nuxt Image parameters like width, format, fit, quality and so on. E.g, this code:

Will render as a [responsive image](/help/sirv-media-viewer/core-features/responsive-images/) with a srcset:

![](https://demo.sirv.com/harris-large.jpg?w=500&format=png)

```html
<img src="https://demo.sirv.com/harris-large.jpg?w=500&format=png" width="500" srcset="https://demo.sirv.com/harris-large.jpg?w=500&format=png 1x, https://demo.sirv.com/harris-large.jpg?w=1000&format=png 2x" />
```

To use Sirv specific parameters, you can use the modifiers prop, here’s an example:

This will return this image:

![Sirv watermark demo](https://demo.sirv.com/t-shirt-man.jpg?watermark=/watermark-v1.png&watermark.position=center&watermark.scale.width=30%&h=500)

```html
<img class="Sirv" data-src="https://demo.sirv.com/t-shirt-man.jpg?watermark=/watermark-v1.png&watermark.position=center&watermark.scale.width=30%&h=500" alt="Sirv watermark demo" />
```

## Full list of options

Here’s a full list of available modifiers:

| Parameter | Translates to | Description |
| --- | --- | --- |
| `width` | w | Width of image |
| `height` | h | Height of image |
| `s` | s | Resize the image by its biggest side |
| `quality` | q | JPEG image quality (percentage) |
| `fit` | scale.option | Image scaling options |
| `profile` | profile | Apply a Sirv [profile](/help/dynamic-imaging/profiles/) |
| `format` | format | Image format served (defaults to [optimal](/help/dynamic-imaging/format-quality/format/#optimal)) |
| `webpFallback` | webp-fallback | Image format for browsers without WebP support |
| `subsampling` | subsampling | Chroma subsampling to reduce JPEG file size |
| `gifCompression` | gif.lossy | Apply lossy compression, to reduce GIF file size |
| `crop` | crop.type | Automatically crop to edge of image contents; point of interest; or face |
| `cropAr` | crop.aspectratio | Aspect ratio of the crop |
| `cw` | cw | Crop the image to a specific width |
| `ch` | ch | Crop the image to a specific height |
| `cx` | cx | Position to start image crop (from top) |
| `cy` | cy | Position to start image crop (from left) |
| `cropPaddingX` | crop.pad.x | Add padding to left/right of crop area |
| `cropPaddingY` | crop.pad.y | Add padding to top/bottom of crop area |
| `canvasHeight` | canvas.height | Create a canvas around the image (height) |
| `canvasWidth` | canvas.width | Create a canvas around the image (width) |
| `canvasAr` | canvas.aspectratio | Aspect ratio of the canvas from 1-99 e.g. 16:9 |
| `canvasPosition` | canvas.position | Position of the canvas behind the image |
| `canvasBorderWidth` | canvas.border.width | Adds additional width left and right of the canvas |
| `canvasBorderHeight` | canvas.border.height | Adds additional height above and below the canvas |
| `canvasBorderColor` | canvas.border.color | Color of the canvas border e.g. E0AA80 or red |
| `canvasBorderOpacity` | canvas.border.opacity | Opacity of the canvas border |
| `watermark` | watermark | Filepath of the image to be overlayed |
| `watermarkPosition` | watermark.position | Position of the watermark on the image |
| `watermarkPositionGravity` | watermark.position.gravity | Starting point for shifting the x & y values |
| `watermarkPositionX` | watermark.position.x | Position of the watermark (from left) |
| `watermarkPositionY` | watermark.position.y | Position of the watermark (from top) |
| `watermarkWidth` | watermark.scale.width | Width of watermark |
| `watermarkHeight` | watermark.scale.height | Height of watermark |
| `text` | text | Display text on your image |
| `textBase64` | text.text64 | Alternative to text parameter, with Base64 encoding |
| `textSize` | text.size | Width of text area in relation to image |
| `textAlign` | text.align | Align the multiline text |
| `textPosition` | text.position | Location of the text on the image |
| `textPositionX` | text.position.x | Location of the text (from left) |
| `textPositionY` | text.position.y | Location of the text (from top) |
| `textPositionGravity` | text.position.gravity | Master location of the text on the image |
| `textFontSize` | text.font.size | Fix the size of the text in px |
| `textFontStyle` | text.font.style | Style of the text |
| `textFontFamily` | text.font.family | Choose a font e.g. “Open Sans” |
| `textFontWeight` | text.font.weight | Choose font weight (light, normal, semi-bold, bold, extra-bold) |
| `textColor` | text.color | Text color e.g. E0AA80 or E0AA8020 |
| `textOpacity` | text.opacity | Text opacity |
| `textOutlineWidth` | text.outline.width | Add an outline around the text |
| `textoutlineColor` | text.outline.color | Color of the text outline |
| `textOutlineOpacity` | text.outline.opacity | Opacity of the text outline |
| `textOutlineBlur` | text.outline.blur | Blur the edge of the text outline |
| `textBackgroundColor` | text.background.color | Background color e.g. E0AA80 or E0AA8020 |
| `textBackgroundOpacity` | text.background.opacity | Background opacity |
| `sharpen` | sharpen | Sharpen the image |
| `blur` | blur | Blur the image |
| `grayscale` | grayscale | Make the image black & white |
| `colorize` | colorize | Overlay a color on the image |
| `colorizeColor` | colorize.color | The color of the colorize option |
| `colorizeOpacity` | colorize.opacity | Opacity of the color overlay |
| `colortone` | colortone | Change the color tone of the image |
| `colortoneColor` | colortone.color | Apply a color tone to an image |
| `colortoneLevel` | colortone.level | Set the level of blending with the original image |
| `colortoneMode` | colortone.mode | Apply the color tone to the entire image or shadows/highlights only |
| `vignette` | vigette.value | Adjust the depth of the vignette |
| `vignetteColor` | vigette.color | Add a vignette (dark edges) around the image |
| `lightness` | lightness | Change the lightness of the image |
| `colorlevelBlack` | colorlevel.black | Adjust black level of image |
| `colorlevelWhite` | colorlevel.white | Adjust white level of image |
| `histogram` | histogram | Display a histogram of RGB levels |
| `hue` | hue | Change the hue of the image |
| `saturation` | saturation | Change the saturation of the image |
| `highlights` | highlights | Change the highlights of the image |
| `shadows` | shadows | Change the shadows of the image |
| `brightness` | brightness | Change the brightness of the image |
| `exposure` | exposure | Change the exposure of the image |
| `contrast` | contrast | Change the contrast of the image |
| `rotate` | rotate | Number of degrees to rotate the image |
| `flip` | flip | Flip image vertically (mirror) |
| `flop` | flop | Flip image horizontally (mirror) |
| `opacity` | opacity | Opacity of PNG images |
| `frameStyle` | frame.style | Add a frame around the image |
| `frameColor` | frame.color | Frame color e.g. E0AA80 or E0AA8020 |
| `frameWidth` | frame.width | Frame width |
| `frameRimColor` | frame.rim.color | Frame rim color e.g. E0AA80 or E0AA8020 |
| `frameRimWidth` | frame.rim.width | Frame rim width |
| `pdfPage` | page | Page number of PDF when converted to image |

Any other Sirv dynamic imaging option can be added to the image URL in the same way.
