¿Acelerar el tiempo de captura de pantalla de phantomjs?

While running the rasterize.js example provided by PhantomJS, I find it I have to wait 20 seconds or more until a web page image is produced.

Is there any possible way to speed this up without consuming a lot of resource? I am basically looking to rapidly produce series of sequential images captured from webpages loaded with PhantomJS. It would be really great if I could output Phantomjs somehow to a video stream even.

For now I would look for something that just takes a screenshot of a web page within 1~2 second range with PhantomJS. If there's already a project or library which accomplishes this that would be great too.

preguntado el 03 de mayo de 12 a las 07:05

Most like PhantomJS waits until all resources (inlined and/or needed by the web page) are available before capturing the page into an image. The best way to verify this is by using its network traffic analysis feature, refer to the example in code.google.com/p/phantomjs/wiki/QuickStart#Network_traffic for more details. In all cases, without knowing the site to be rasterized and all other details, it's hard to analyze the problem. I also highly recommend asking this kind of question to PhantomJS mailing-list. -

I am using the same svg (the tiger) example from the code google site. I will have a look at the network traffic, I am on windows xp btw. -

puedes usar phantomjscloud.com/site/docs.html instead of rolling your own (disclaimer: i wrote it) -

Just an idea, but if you make a smaller viewport size with page.viewportSize = { width: 480, height: 800 }; That should be done faster. -

I'm having the same issue. It just takes far too long. Did you ever find a solution to this? -

1 Respuestas

In case your images URL are hardcoded into html response, then you can do next things:

  1. Get html body
  2. Parse it and get your images
  3. And then render them into something like PhantomJS or anything else WebKit based.

You can take a look to this sample, https://github.com/eugenehp/node-crawler/blob/master/test/simple.js

Me gusta:

var Crawler = require("../lib/crawler").Crawler;

var c = new Crawler({
    // "timeout":60,
    callback:function(error,result,$) {
        console.log("Got page");
        $("img").each(function(i,img) {


Respondido el 17 de junio de 12 a las 22:06

This is how to extract images from websites... the question is how to use the capture screen function of phantomJS to take screen shots of what a browser would see on a web page request in less than 20 seconds. Very different things. - Lorenz03Tx

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.