Hi I'm trying to use wkhtmltoimage
to generate a JPEG format image.
I've tried --dpi
then got Unknown long argument --dpi
.
Hi I'm trying to use wkhtmltoimage
to generate a JPEG format image.
I've tried --dpi
then got Unknown long argument --dpi
.
You can try to use the --zoom
parameter for this. Assuming you want a 300 dpi image and your system's default resolution is 96 dpi, you'd need to set it to 300 / 96 = 3.125. Of course you have to scale up your virtual screen width as well. So further assuming you want to capture a website as it is displayed at a screen width of 1000 pixels, you also need to set --width
to 1000 * 3.125 = 3125.
The complete command could look like this:
wkhtmltoimage
--disable-smart-width \
--zoom 3.125 \
--width 3125 \
<input-url> \
<output-file>
I'm not sure though, how the zoom affects images on the website, that were originally scaled down. Also depending on your further processing of the image you might need to adjust the dpi value in the metadata of the output file. In this case it would still be set to 96 dpi.
Of course it would be nice to have the --dpi
parameter of wkHTMLtoPDF work here as well and do the calculations internally ;)
© 2022 - 2024 — McMap. All rights reserved.