我使用wkhtmltoimage从网络服务器获取屏幕截图,它总是获得1024px png图像。我能做错什么?
/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
答案 0 :(得分:0)
xvfb-run命令中指定的屏幕分辨率为1280x1024,因此抓取的屏幕截图也是1280x1024。您可以使用wkhtmltoimage命令中的参数更改模拟屏幕的分辨率或裁剪图像。引用wkhtmltoimage手册:
--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