Description
Currently, a PNG encoded by node-canvas doesn't contain the correct physical size information in the header. In canvas_write_png()
in PNG.h
you never call png_set_pHYs()
to set the physical units in the PNG header, so it defaults to 72 PPI. Most screens are 96 PPI.
Generally it would be awesome to have a way to set the physical size of the canvas from javascript. I personally would like to use this for print, where the DPI in the header changes the way the document is printed. Right now I am running an imagemagick command after the PNG is written to a file, but this is inefficient.
I could offer a patch, but of course it would be another non-standard function. I'd like to hear the thoughts of the project leaders on whether this would be something of general interest or not before I write anything.
This is potentially related to Issue #716, in that scaling the canvas may indicate that the user is looking to produce a PNG for higher PPI screens, and the PNG/SVG/PDF should probably reflect the true physical dimensions of the display device.