I want to make using PhantomJS screenshot of the site. I found in the examples of the rasterize.js script going with it, but I don’t understand how to run it with what parameters to get the screenshot size I need.

You need to make a jpg image of 400x300pk in size, with screenshots of the site, and only one screen, i.e. if the page is long and scrolls down, then you do not need to make a screen of the whole page, but only what is placed on one screen is 1900 * 600pcs

  • Should it be done exactly on js? I can offer an option on python. - hedgehogues
  • Yes you need to JS phantom. I used to use the service s-shot.ru to make inquiries to it, get a screen, but something recently it began to work as if it was not stable. I decided on the phantom to do the same so as not to depend on third-party services. - Demon1X

1 answer 1

{ "id": "sanity_tests", "viewports": [ { "label": "phone", "width": 320, "height": 3294 }, { "label": "tablet", "width": 768, "height": 3294 }, { "label": "desktop", "width": 1280, "height": 3294 } ], "scenarios": [ { "label": "home_page", "url": "https://some-page.com/", "hideSelectors": [], "removeSelectors": [], "hoverSelector": "", "selectors": [ "body" ], "delay": 4000, "misMatchThreshold": 0.1 }, { "label": "contacts", "url": "https://some-page.com/contacts", "hideSelectors": [], "removeSelectors": [], "hoverSelector": "", "selectors": [ "body" ], "delay": 4000, "misMatchThreshold": 0.1 } ], "paths": { "bitmaps_reference": "backstopjs_tests/dev_reference", "bitmaps_test": "backstopjs_tests/dev_test", "html_report": "backstopjs_tests/dev_html_report", "ci_report": "backstopjs_tests/dev_ci_report" }, "casperFlags": [ "--ignore-ssl-errors=true", "--ssl-protocol=any" ], "report": ["CLI", "browser"], "engine": "phantomjs", "cliExitOnFail": false, "debug": false } 

And in size to the device you specify the size you need

  • Please clarify the answer. Use the edit button to transfer the comment to the response. - 0xdb
  • Um ... I see no reason why this config at least somehow answers the question asked. - Qwertiy