---
title: "Image | Device Pixel Ratio"
description: "<p>To implement the&nbsp;device pixel ratio functionality of the Image Delivery API, you require two parameters \"dpr\" and \"height or width\".</p>
<p>The&nbsp;<span data-type=\"inlineCode\">dpr</span> parameter lets you deliver images with appropriate size to devices that come with a defined device pixel ratio. The device pixel ratio of any device determines the screen resolution that its CSS would interpret. This ratio is the ratio between the physical pixels of the image and its logical pixels.&nbsp;
</p>
<p>For example, if the iPhone 6s has a device pixel ratio of <span data-type=\"inlineCode\">2</span>, it means that the actual resolution is double the logical resolution. Different devices have different pixel ratios. This parameter, therefore, lets you render appropriately sized images to different devices.&nbsp;<br>
</p>
<p>The value for this parameter could be a whole number (between <span data-type=\"inlineCode\">1</span> and <span data-type=\"inlineCode\">10000</span>) or any decimal number (between <span data-type=\"inlineCode\">0.0</span> and <span data-type=\"inlineCode\">9999.9999...</span>).<br>
</p>
<p>Along with the <span data-type=\"inlineCode\">dpr</span> parameter, you need to specify either the <span data-type=\"inlineCode\">height</span> or <span data-type=\"inlineCode\">width</span> parameter&nbsp;to&nbsp;dynamically resize the output image. If you only specify the <span data-type=\"inlineCode\">height</span> parameter, then&nbsp;the <span data-type=\"inlineCode\">height</span> parameter will automatically adjust the width of the image using the aspect ratio of the image.&nbsp;And if both the <span data-type=\"inlineCode\">width</span> and <span data-type=\"inlineCode\">height</span> parameters are specified, the given values will be used. Read more about <a href=\"/docs/developers/apis/image-delivery-api#resize-images\">resizing images using the width and height parameters</a>.</p>
<p>The width or height of the output image changes depending on the values that you provide for <span data-type=\"inlineCode\">dpr</span> and <span data-type=\"inlineCode\">height</span> or <span data-type=\"inlineCode\">width</span>. For example, for a device pixel ratio of <span data-type=\"inlineCode\">2</span> and height <span data-type=\"inlineCode\">50</span>, the height of the output image changes to <span data-type=\"inlineCode\">100</span>.</p>
<p><img src=\"https://images.contentstack.io/v3/assets/blteae40eb499811073/blt06f4d8e36690b133/5a533a2a9209dfef1a8731b7/Device Pixel Ratio(2).png\" data-sys-asset-uid=\"blt06f4d8e36690b133\" alt=\"Device Pixel Ratio(2).png\" data-image=\"367lry8nc5sg\"></p>"
url: "https://www.contentstack.com/docs/developers/apis/image-delivery-api/device-pixel-ratio"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-06-02"
---

# Image | Device Pixel Ratio

To implement the device pixel ratio functionality of the Image Delivery API, you require two parameters "dpr" and "height or width".

The dpr parameter lets you deliver images with appropriate size to devices that come with a defined device pixel ratio. The device pixel ratio of any device determines the screen resolution that its CSS would interpret. This ratio is the ratio between the physical pixels of the image and its logical pixels. 

For example, if the iPhone 6s has a device pixel ratio of 2, it means that the actual resolution is double the logical resolution. Different devices have different pixel ratios. This parameter, therefore, lets you render appropriately sized images to different devices.   

The value for this parameter could be a whole number (between 1 and 10000) or any decimal number (between 0.0 and 9999.9999...).  

Along with the dpr parameter, you need to specify either the height or width parameter to dynamically resize the output image. If you only specify the height parameter, then the height parameter will automatically adjust the width of the image using the aspect ratio of the image. And if both the width and height parameters are specified, the given values will be used. Read more about [resizing images using the width and height parameters](/docs/developers/apis/image-delivery-api#resize-images).

The width or height of the output image changes depending on the values that you provide for dpr and height or width. For example, for a device pixel ratio of 2 and height 50, the height of the output image changes to 100.

![Device Pixel Ratio(2).png](<https://images.contentstack.io/v3/assets/blteae40eb499811073/blt06f4d8e36690b133/5a533a2a9209dfef1a8731b7/Device Pixel Ratio\(2\).png>)

### Set device pixel ratio

**GET** `/assets/{stack_api_key}/{asset_uid}/{file_uid}/filename.jpg?environment={environment_name}&dpr={dpr_value}`

**Note:** Check out the [limitations](/docs/developers/apis/image-delivery-api#limitations-with-optimizing-image) that are applicable here.

#### Query Parameters

- **dpr** (optional)
  Enter the device pixel ratio that needs to be applied on the image.
- **height** (optional)
  Enter the value of the image height in pixels or percentage. For example, 100 or 0.90 or 250p.
- **width** (optional)
  Enter the value of the image width in pixels or percentage. For example, 100 or 0.90 or 250p.
- **environment** (required)
  Enter the environment scoped to your delivery token.