How to Take Website Screenshots with GrabzIt and Python
Use GrabzIt’s Python client to capture a website as an image, choose between callback and file retrieval, and handle full-page and dynamic pages.
To capture a website with GrabzIt’s Python API, create a GrabzItClient with your application key and secret, call URLToImage(url), then retrieve the completed capture with SaveTo(path) or Save(callback_url). The first approach waits and writes a local file; the callback approach returns the result asynchronously to a reachable handler.
1. Install and configure the Python client
Create a GrabzIt account and obtain the application key and secret from its account settings. Install the Python library using the installation instructions in GrabzIt’s Python API documentation. The documentation supports manual installation or pip installation; check its current instructions for the package name and compatibility details before pinning a version.
from GrabzIt import GrabzItClient
client = GrabzItClient.GrabzItClient("APPLICATION KEY", "APPLICATION SECRET")
Keep the secret out of source control. In an application, load it from your environment or secret store and avoid logging it. Replace the placeholders above with the credentials for your account.
2. Capture a URL and save it to a file
This is the minimal complete synchronous workflow. URLToImage submits the page, and SaveTo waits for the result and writes it to the path you provide.
from GrabzIt import GrabItClient
client = GrabzItClient.GrabzItClient("APPLICATION KEY", "APPLICATION SECRET")
client.URLToImage("https://example.com")
client.SaveTo("result.jpg")
Use a path your process can write. For a relative path, the file is created relative to the process’s working directory. This is useful for local scripts, desktop programs, and localhost development, where an external service cannot call a local callback handler. GrabzIt’s Python API documentation recommends SaveTo on localhost.
3. Choose synchronous or callback retrieval
| Method | What happens | Use it when |
|---|---|---|
SaveTo(path) |
The call waits for the capture and writes it to disk. | A local script, desktop tool, or other caller can block while it completes. |
Save(callback_url) |
GrabzIt calls your handler when processing finishes. | Your application has a publicly reachable callback endpoint and should not hold the original request open while the capture runs. |
For a callback workflow, your handler must be reachable by GrabzIt and should follow the callback instructions in the official guide. Do not point it at localhost unless you have made that endpoint reachable through an appropriate development setup. The technical reference also documents GetResult(id) to obtain capture bytes and GetStatus(id) to check status; use the current reference for the exact return values and callback handling details.
Choose based on your runtime and request lifecycle rather than assuming one method is faster. No fixed completion time is promised by the documentation.
4. Configure the output and capture
GrabzIt’s Python image options include output format, dimensions, full-length capture, quality, and page interaction controls. Consult the current image options reference and technical reference for exact option names and supported values.
Image format and quality
JPG is the documented default. PNG is an option when JPG quality is not sufficient. The options page lists JPG, PNG, WEBP, BMP variants, and TIFF; the technical reference presents SVG as an image format option too, so verify SVG’s current support and constraints before relying on it. The technical reference describes quality for JPG and WEBP output. Choose a format based on whether you need smaller files, lossless detail, or compatibility with downstream consumers.
Full-length screenshots
The documented full-length image configuration sets browserHeight, width, and height to -1. This captures the page vertically; it does not create an infinitely wide browser. GrabzIt explicitly documents that there is no full-length browser-width option.
Dynamic pages and targeted captures
For pages whose content appears after initial navigation, the technical reference includes a millisecond delay and waitForElement. You can target an element with targetElement, hide page parts with hideElement, or interact before capture with clickElement or hoverElement. Only one of click, hover, or scroll can be specified at a time according to the reference. These controls can help with dynamic layouts, but they do not guarantee that every site renders identically on every capture.
Mobile rendering
The Python API can capture mobile versions of websites, but the result depends on the target site having a suitable mobile version. GrabzIt warns that this may not work in all circumstances. Treat mobile rendering as site-dependent; the gathered documentation does not establish a guaranteed device model or viewport size.
5. Render HTML or a local HTML file
For input that is already HTML rather than a public URL, the Python API also documents HTMLToImage for HTML content and FileToImage for an HTML file. The request still needs a save or retrieval step.
from GrabzIt import GrabzItClient
client = GrabzItClient.GrabzItClient("APPLICATION KEY", "APPLICATION SECRET")
client.HTMLToImage("<html><body><h1>Hello</h1></body></html>")
client.SaveTo("html-result.jpg")
For a file, follow the current technical reference’s expected file argument and path handling:
from GrabzIt import GrabzItClient
client = GrabzItClient.GrabzItClient("APPLICATION KEY", "APPLICATION SECRET")
client.FileToImage("page.html")
client.SaveTo("file-result.jpg")
6. cURL, Python requests, and Node.js alternatives
The GrabzIt workflow in this article uses its Python client and application credentials. The research sources do not establish an equivalent direct cURL or Node.js endpoint for this exact flow, so do not copy another provider’s API syntax and assume it works with GrabzIt. For a generic screenshot API call, ScreenshotNeo accepts a single GET request; the examples below use its documented API and require a ScreenshotNeo access key.
cURL
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
Python
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer())));
For ScreenshotNeo’s available options and response behavior, see the ScreenshotNeo API documentation.
7. Troubleshooting
| Symptom | Likely cause | What to check |
|---|---|---|
| Authentication or request failure | The application key or secret is missing, mistyped, or belongs to a different account. | Check both credential values and ensure the process is loading the intended configuration. |
| No output file appears | The path is not where you expect, the process cannot write there, or retrieval did not complete successfully. | Use an explicit writable path and check the current client reference for error handling and result status. |
| Callback never arrives | The callback endpoint is not publicly reachable, or callback handling does not match the documented flow. | Use a reachable handler and follow GrabzIt’s callback guide. For localhost or desktop use, prefer SaveTo. |
| Page content is missing | The site may render content after navigation or require an interaction. | Try an appropriate documented delay, wait-for-element, click, or hover option; verify the selected element exists and is visible. |
| Capture is cropped or dimensions are unexpected | Width, height, or browser height settings do not match the intended capture. | Review the image options. For a full-length capture, use the documented -1 settings for browser height, width, and height; remember browser width is not full-length. |
| Mobile view looks like desktop | The site may not serve a special mobile layout under the selected request conditions. | Check the site’s responsive behavior and treat mobile capture as site-dependent. |
| Output quality or size is unsuitable | The default JPG format or quality is not a fit for the content. | Try a documented alternative such as PNG, or tune quality where supported for JPG/WEBP. |
8. Performance, reliability, and cost considerations
SaveTo blocks the caller until the capture is ready, so account for that in command-line jobs, web request timeouts, and worker capacity. A callback allows an application to accept the request and handle the completed result later, but requires a reachable endpoint and reliable callback processing. Avoid claiming a fixed capture duration: the cited documentation provides no dependable timing figure.
For reliability, persist the capture identifier or application-level job state where appropriate, make callback processing safe to repeat, and use the documented status/result methods according to their current reference. Validate output files before downstream use, especially when the target page is dynamic. The dossier does not establish current GrabzIt pricing, quotas, or service guarantees; check its official current account and pricing information when estimating costs.
9. Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server for developers. It accepts one GET request and returns an image or PDF, with controls for full-page capture, element selection, viewport and device presets, waits, interactions, request blocking, cookies, headers, and more. See the documentation for the API parameters.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo accepts cookie and consent banners like a visitor, then removes more than 60 known consent platforms along with newsletter popups and chat widgets; each cleanup step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots, and every feature is on every plan.
Sign up free for 1,000 screenshots a month with no card.
10. FAQ
Does calling URLToImage save the screenshot by itself?
No. It submits the capture request; follow it with a save or retrieval method such as SaveTo or Save.
Can I capture a page at unlimited width?
No. GrabzIt documents full-length page height settings, but says there is no full-length browser width option.
Will the mobile option always show the mobile site?
No. The result depends on the site’s mobile implementation and may not work in all circumstances.
Can I use a callback from a local script?
A callback needs a handler GrabzIt can reach. For localhost workflows, use the synchronous SaveTo approach described in the Python guide.


