Answer the question
In order to leave comments, you need to log in
How to get webkit screenshots from the command line?
You need to run the webkit engine under Debian7 or under Windows7 in order to get a screenshot of the entire page as part of the deployment script.
If under Debian, then preferably without x.
I tried various python scripts and the python package manager pip, which did not help me, because for some reason the packages, like one, did not bring dependencies and did not work.
ps I'm not familiar with python.
I also tried to install some packages with names like webkit2png, webkit2pdf, webkit. However, the presence of X11 in their dependencies scared me.
UPD
Here I found a similar question, the answer to which is PhantomJS
.
This solution seems to me more convenient, unlike python-based scripts, because it is for Node.js.
Now I'm looking for how specifically to get a screenshot with it.
UPD
There is a link phantomjs.org/screen-capture.html on the main page of the project :)
Now I will try.
If someone has already done, I will be glad to advice. UPD
Although the result was obtained, its quality wants to leave the best.
Currently phantomjs uses Mozilla/5.0 (Unknown; Linux i686) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.7 Safari/534.34
Which seems to be roughly equivalent to the terribly outdated Safari 5, which doesn't support all the new stuff from CSS3, so necessary to me.
ps along the way, I found a utility that allows you to run applications that require X11 without these Xs, i.e. on the server (thanks
@
0neS )
_
_ run and try to somehow pull out a screenshot from there.
UPD
The page e-method.blogspot.fr/2010/11/google-chrome-with-xv... describes how to do what I need (it's called headless running).
Now I will try.
Perhaps someone has already done it?
UPD
Nothing happened.
Installed Chromium (the original article suggested google-chrome, but it was not in the repositories), xvfb and imagemagick (to take a screenshot)
[email protected]: ~# apt-get install xvfb imagemagick chromium-browser
Ran
xvfb-run --server-args='-screen 0, 1024x768x24' chromium -start-maximized http://google.com > & /dev/null &
DISPLAY=:99 import -window root myimage.png
-bash: syntax error near unexpected token `&'
xvfb-run --server-args='-screen 0, 1024x768x24' chromium -start-maximized http://google.com > /dev/null &
DISPLAY=:99 import -window root myimage.png
No protocol specified
import.im6: unable to open X server `:99' @ error/import.c/ImportImageCommand/368.
Answer the question
In order to leave comments, you need to log in
Have you tried all of these options?
www.binarytides.com/take-webpage-screenshot-from-c...
maxivak.com/take-screenshots-of-websites-from-comm... (first two)
Take PhantomJS and don't worry. There are examples, and from experience this is the most uncluttered and supported solution for such tasks. Next comes wkhtmltopdf/wkhtmltoimage, but it can be buggy and... well, it seems to have worse support. And yes, there are fewer opportunities.
Do not tell me, your solution, to which you came (raising the virtual display), how resource-intensive it is and how long it takes?
For example, if I need to get 100 screenshots of a small size (300x300). It is clear that it depends on the sites and the download time; if we take the average values.
node-webkitgtk (GitHub: kapouer/node-webkitgtk , License: MIT, npm: webkitgtk)
by Jérémy Lal is a collection of webkitgtk bindings for Node. A product's API can be called in a chain, so you can do something like this:
Summary : Installing this contraption is a big problem.
-------------------------------------------------- -------------------------------------------------- -----------------------
There is also segmentio/nightmare , but although it is convenient and easy to install, it works on top of phantomjs and therefore also uses the extremely old engine version.
Summary : absolutely not usable for taking screenshots (layout floats).
-------------------------------------------------- -------------------------------------------------- -----------------------
So the method outlined at the end of the question remains the most effective. Its cons:
- Long installation procedure
- Snapshot of only the first screen
- In order to prevent the browser from getting into the picture, you need to pass the “kiosk”-mode parameter in a tricky way.
Try the webkit-image-gtk or webkit-image-qt package
They have the webkit-image utility. It takes a full screenshot of the page i.e. throughout the length and width.
The syntax can be found in man webkit-image. Although it is primitive in principle:
webkit-image www.onliner.by > output.png
example of the command
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question