dpr
Device pixel ratio.
The dpr
parameter provides a means to multiply image dimensions in order to translate logical pixels (also 'CSS pixels') into physical pixels. The device pixel ratio is therefore the ratio between physical pixels and logical pixels.
It is usually possible for client-side software to query the host system to determine the DPR of the display the user is viewing. In web browsers, this is available as the Window.devicePixelRatio variable in JavaScript. The iPhone 5 reports a device pixel ratio of 2, because the physical linear resolution is double the logical resolution.
- Physical Resolution: 960 x 640
- Logical Resolution: 480 x 320
Other devices report varying device pixel ratios, including non-integer ones. For example, the Nokia Lumia 1020 reports 1.6667
, whereas the Samsung Galaxy S4 reports 3
.
Syntax
dpr={value}
value
may be any number between 1 and 10.
Examples
Click the links to view the transformed image using a demo Fastly IO service.
Example usage | Description |
---|---|
?width=200&dpr=2 | Resize the width to 400px (200 CSS pixels for screens with a device pixel ratio of 2) |