Reference pixelDensity()

pixelDensity()

Gets or sets the pixel density for high pixel density displays.

By default, the density will be set to 1.

Call this method with no arguments to get the default density, or pass in a number to set the density. If a non-positive number is provided, it defaults to 1.

Syntax

pixelDensity([density])

Parameters

density
Number:

A scaling factor for the number of pixels per side

Returns

Number: The current density if called without arguments, or the instance for chaining if setting density.
Notice any errors or typos? Please let us know. Please feel free to edit src/image/p5.Image.js and open a pull request!

Related References