DPR - Device Pixel Ratio
Use the dpr transformation to request a higher-density variant for screens with a device pixel ratio above 1.
Overview
High-density displays can look sharper when the delivered image has more physical pixels than its CSS display size. Use dpr with width and height when building responsive image sets for retina and high-resolution screens.
For example, a 400px wide image at dpr=2 can provide enough source pixels for a 400 CSS px slot on a 2x display.
Syntax
| Field | Value |
|---|---|
| Canonical parameter | dpr |
| Alias | none |
| Accepted values | Number 0.01 through 8 |
Example
https://cdn.imgwire.dev/{organization_id}/{environment_id}/{image_id}?width=400&dpr=2&format=auto&quality=auto
image.url({
width: 400,
dpr: 2,
format: 'auto',
quality: 'auto',
});
imgwire images url img_123 --width 400 --dpr 2 --format auto --quality auto
Live examples
These examples all render at 240 CSS px wide. The dpr value changes the delivered pixel density, not the layout width. A width=240&dpr=2 URL requests enough source pixels for a 240 CSS px slot on a 2x display.
Responsive image example
Use DPR variants in srcset when the layout slot has a stable CSS size.
<img
src="https://cdn.imgwire.dev/.../img_123?width=400&dpr=1&format=auto&quality=auto"
srcset="
https://cdn.imgwire.dev/.../img_123?width=400&dpr=1&format=auto&quality=auto 1x,
https://cdn.imgwire.dev/.../img_123?width=400&dpr=2&format=auto&quality=auto 2x
"
width="400"
height="267"
alt="Product preview"
/>
Best practices
- Use DPR variants for images shown at fixed CSS sizes on high-density screens.
- Pair DPR with
format=autoandquality=autoto control delivery cost. - Avoid generating unnecessary high-DPR variants for images that are already visually small or low-detail.
- Prefer responsive image helpers when your framework or Imgwire SDK provides them.
Common mistakes
- Confusing DPR with CSS width. DPR changes delivered pixel density, not the layout size by itself.
- Shipping only a 3x variant to all screens.
- Forgetting to set HTML width and height attributes for layout stability.
Related pages
Last updated at: May 9, 2026