Py5Image.pixel_density

Pixel density of the Py5Image object.

Examples

1
2
3
4
def setup():
    py5.pixel_density(2)
    img = py5.create_image(100, 100, py5.RGB)
    py5.println(img.pixel_density, img.pixel_width, img.pixel_height)  # prints 1, 100, 100

Description

Pixel density of the Py5Image object. This will always be equal to 1, even if the Sketch used pixel_density() to set the pixel density to a value greater than 1.

Underlying Java field: PImage.pixelDensity

Updated on September 11, 2021 16:51:34pm UTC