Hear from Slack, the ACLU, TED, & more at our customer summit in San Francisco Register
LOG IN SIGN UP
Documentation

Device Pixel Ratio

Features

Description

The dpr parameter is used to serve correctly sized images for devices that expose a device pixel ratio. The device pixel ratio is the ratio between physical pixels and logical pixels. For instance, the iPhone 5 reports a device pixel ratio of 2, because the physical linear resolution is double the logical resolution.

Other devices report different device pixel ratios, including non-integer ones. For example, the Nokia Lumia 1020 reports 1.6667, whereas the Samsumg Galaxy S4 reports 3.

API Pattern

dpr={value}

Parameter

Parameter Description
dpr Device Pixel Ratio.

Parameter Values

Value Description
Integer A whole number between 1 and 10000.
Float Decimal number between 0.0 and 9999.999…

Examples

Description HTML Demo
Resize & Device Pixel Ratio - Resize the width to 200px for screens with a device pixel ratio of 2. <img src="image.jpg?width=200&dpr=2"/> Example