summaryrefslogtreecommitdiff
path: root/vendor/league/glide/docs/1.0/api/pixel-density.md
blob: 5f24d77487e1601672b9ea69d7806c57c8503911 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
---
layout: default
title: Pixel Density
---

# Pixel Density

## Device pixel ratio `dpr`

The device pixel ratio is used to easily convert between CSS pixels and device pixels. This makes it possible to display images at the correct pixel density on a variety of devices such as Apple devices with Retina Displays and Android devices. You must specify either a width, a height, or both for this parameter to work. The default is 1. The maximum value that can be set for dpr is 8.

~~~ html
<img src="kayaks.jpg?w=250&dpr=2">
~~~

[![© Photo Joel Reynolds](https://glide.herokuapp.com/1.0/kayaks.jpg?w=250&dpr=2)](https://glide.herokuapp.com/1.0/kayaks.jpg?w=250&dpr=2)