문제

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
도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top