Apify Screenshot Actor Returns the Wrong Page Size: Viewport Fixes
Fix an Apify screenshot that has the wrong dimensions by checking its Actor schema, viewport, full-page mode, device scale factor, and output pixels.
Start with the exact Apify Store Actor’s current input schema. There is no universal set of viewport fields for every screenshot Actor. Check whether it has separate width and height fields, a custom viewport preset, a device scale factor, and a full-page switch. For a screenshot of only the visible browser window, turn full-page capture off if that Actor supports the option, set its documented custom viewport dimensions, and inspect the saved image’s actual pixel dimensions.
A requested viewport, a full-page capture, and the output image dimensions describe different things. A viewport defines the browser’s visible layout area. Full-page mode can capture content below that area, making the image taller. A device scale factor may affect pixel dimensions relative to CSS viewport units. The exact rules, names, defaults, and limits depend on the Actor and version.
1. Identify the Actor and measure the output
Before changing settings, record the Actor URL or ID, version, submitted input, and the image’s actual width and height in pixels. Without those details, it is not possible to know whether a particular field was ignored, overridden, or interpreted differently than expected.
- Open the exact Actor page in Apify Store and inspect its current input schema, rather than copying field names from another screenshot Actor.
- Find the settings for viewport or device, width, height, full-page capture, and device scale factor, if present. Note documented defaults, allowed values, and any maximum dimension or height.
- Save the output image locally and inspect its pixel dimensions. Compare these with the requested dimensions and the Actor’s returned metadata, if it provides fields such as
width,height, orpageHeight. - Repeat with a page whose content height is predictable, and keep the Actor version and page state the same while you compare settings.
Apify’s official SDK guide demonstrates the general flow of opening a page, taking a screenshot, and writing the image buffer to the default key-value store. That guide describes a capture technique, not a universal input contract for third-party Store Actors. Apify SDK screenshot guide.
2. Choose viewport-only or full-page capture
Decide what the output should include before adjusting its size:
| Capture mode | What it captures | What to expect |
|---|---|---|
| Viewport-only | The currently visible browser area | Output height is generally bounded by the configured viewport, subject to the Actor’s scale and output rules. |
| Full-page | The document beyond the visible browser area | Output height can follow the page’s scrollable content and exceed the viewport height. |
If the screenshot is unexpectedly tall, check full-page mode first. One published Actor schema documents fullPage as enabled by default and says that, when full-page mode is disabled, the capture is limited to the current viewport and cut at viewportHeight. Those details apply to that Actor schema only; do not assume another Actor uses the same field name, default, or behavior. Quality Website Screenshot API schema.
Some Actors also impose height limits or return metadata describing page height separately from image height. Check the target Actor’s documentation to see whether such controls or fields exist before relying on them.
3. Set the Actor’s viewport and device options
Use the exact field names and combinations in your Actor’s schema. Common configuration patterns include:
- Custom width and height: Enter the intended dimensions in the Actor’s documented fields. Some Actors require selecting a
custompreset before these values take effect. - Device preset: A preset can supply its own viewport. Check whether choosing one overrides or disables manually supplied dimensions.
- Device scale factor: Treat this as a separate setting from CSS viewport width and height. Where the Actor exposes it, consult its schema to learn how it affects output pixels.
- Full-page switch: Disable it for a window-sized capture, if the Actor provides that control. For a whole-page capture, expect output height to differ from viewport height.
- Dimension limits: Use only values allowed by the current schema. If a requested size exceeds a limit, the Actor may reject, cap, or otherwise handle it according to its documented behavior.
For example, one published Actor schema lists device presets, custom viewport dimensions, and deviceScaleFactor separately, and says custom controls can be ignored when a device preset is selected. That is a useful configuration pattern to check for, not a rule for every Actor. Website Screenshot Capture schema.
4. Check image dimensions and format
Read the saved file’s dimensions instead of assuming that the requested viewport equals the final pixel size. A scale factor may affect pixel density, and full-page mode may extend the output height. If the Actor returns image dimension metadata, compare it with the file itself; metadata field names and meanings are Actor-specific.
Image format is another separate setting. Apify Academy says screenshots default to PNG and that JPEG can be selected through the screenshot type option. Changing PNG to JPEG changes the file format, not the viewport. See Apify Academy’s page waiting and screenshot guidance.
5. Wait for the page state you intend to capture
Correct viewport settings cannot prevent layout changes that happen after capture begins. A late-loading image, font, or other page content can alter the visible layout or the full-page height. When the page has navigated, wait for navigation as appropriate to the Actor’s browser framework. When a specific element signals that the page is ready, a selector wait can be more targeted than an arbitrary delay. Apify Academy documents navigation and selector waiting approaches in its page waiting guide.
Use the wait mechanism the Actor actually exposes. Waiting is a synchronization step; it does not substitute for choosing the correct viewport, preset, scale factor, or capture mode.
6. Troubleshoot the mismatch
| Symptom | Likely cause | What to check or change |
|---|---|---|
| Image is much taller than requested | Full-page mode captures scrollable content, or the page height changes while loading. | Check the Actor’s full-page setting and documented height limits. For viewport-only output, disable full-page capture if supported. Wait for the intended page state. |
| Custom width or height has no effect | The Actor requires a custom preset, or a selected device preset takes precedence. | Check the schema for preset requirements and overrides. Use the documented custom option and exact field names. |
| Pixel dimensions differ from the viewport values | A device scale factor or Actor-specific output behavior may affect pixels. | Inspect the scale-factor documentation and the actual image dimensions. Do not assume CSS viewport units and output pixels are interchangeable. |
| Image dimensions vary between runs | Content loads late or changes the page layout before capture. | Wait for navigation or a target selector using the Actor’s supported mechanism, then compare again. |
| Input is rejected or an option is ignored | Field names, allowed values, defaults, or rules differ for the Actor or version. | Reopen the exact Actor’s current schema. Check input validation messages and version-specific documentation. |
| Screenshot looks right but has the wrong file type | Image format is configured independently of size. | Check the Actor’s screenshot type option. Apify Academy documents PNG as the default and JPEG as an available choice in its guidance. |
7. Performance, reliability, and cost considerations
- Large full-page captures: More page content means more to render and encode. If you only need the visible window, viewport-only mode avoids capturing the rest of the document.
- Waiting: A targeted selector or navigation wait can avoid capturing before essential content is ready. A fixed delay may be less predictable when page load times vary.
- Repeatability: Keep the Actor version, viewport configuration, preset, scale factor, capture mode, and wait condition consistent when comparing results.
- Limits and billing: The dossier does not establish universal dimension limits, performance figures, or pricing for Apify screenshot Actors. Check the selected Actor’s current schema and the relevant Apify run or usage details for the terms that apply to your setup.
Or skip the browser setup
ScreenshotNeo is a website screenshot API: send one GET request with a URL and receive an image or PDF. Its API parameters include the names used by other screenshot APIs to make switching easier. See the ScreenshotNeo API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo accepts cookie banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots. Every feature is available on every plan.
Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card.
FAQ
Does changing the viewport resize an existing screenshot?
No. It changes the browser dimensions for a new capture. Rerun the Actor with the updated input, then inspect the new output file.
Can I use the Apify SDK guide’s screenshot code as a Store Actor input?
The SDK guide explains a general browser capture and storage flow. It does not define a shared input schema for Store Actors; use the selected Actor’s own current schema.
Why does a viewport-sized capture still show a different page layout?
Responsive websites can rearrange content at different viewport widths. Also check whether a preset or scale factor changes the effective capture configuration, and wait until the page reaches the intended state.


