How to get the PPI of an HTML canvas element?

260 Views Asked by At

I am using WordPress and the plugin Fancy-Product-Designer. I want to have a warning displayed if the uploaded and scaled element does not match 300dpi. The plugin uses an HTML canvas element in order to generate the printing surface. I want to access the child elements and calculate their PPI, taking into consideration the scaling.

Is there any possibility to access child elements of an HTML canvas element or calculating the PPI of a certain rectangle in the canvas?

1

There are 1 best solutions below

0
On

The canvas element is simply a collection of pixels managed by some application. The 'child elements' of the canvas would be managed as objects inside the rendering application (if at all). It would (typically) not be in the DOM. So in short: 'no'.

Also the effective (real) ppi for an image depends on how it is rendered and the clients screen dpi/ print size.