2012-11-14 25 views
0

我使用wkhtmltoimage從網絡服務器抓取截圖,它總是獲得1024px的PNG圖像。我可能做錯了什麼?xvfb和wkhtmltoimage總是抓取1024寬度的圖像

/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

在xvfb的運行命令中指定的屏幕分辨率1280×1024,因此抓住截圖將1280×1024爲好。您可以使用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