Pregunta

Im using wkhtmltoimage to grab an screenshot from a webserver and It always gets 1024px png images. What could I be doing wrong?

/usr/bin/xvfb-run.sh --server-args="-screen 0, 1280x1024x32 -ac +extension GLX +render" wkhtmltoimage --use-xserver -f png --quality 83 --javascript-delay 1000 --transparent ' http://www.whatever.com screenshot.png
¿Fue útil?

Solución

The screen resolution specified in the xvfb-run command is 1280x1024, so the grabbed screenshot will be 1280x1024 as well. You can change the resolution of the emulated screen or crop the image using parameters on the wkhtmltoimage command. Quoting the wkhtmltoimage manual:

--crop-h    <int>   Set height for croping
--crop-w    <int>   Set width for croping
--crop-x    <int>   Set x coordinate for croping
--crop-y    <int>   Set y coordinate for croping
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top