ScreenshotNeo

BlogHow-to

How to Set Screenshot Formats and Image Quality in Apify

Choose PNG or JPEG for Apify screenshots, set quality where the SDK supports it, and save image bytes with matching metadata.

By the ScreenshotNeo team4 October 20266 min read

In Apify, the screenshot format and quality are set by the screenshot method or utility your Actor uses; there is no single setting that applies to every Actor. With Puppeteer, page.screenshot() produces PNG by default. Set type: 'jpeg' to request JPEG. For the Apify SDK 2.3 puppeteer.saveSnapshot utility specifically, screenshotQuality ranges from 0 to 100 and defaults to 50. Check your Actor’s installed SDK and library before using that option.

This guide shows how to capture and store PNG or JPEG bytes in an Apify Actor, how the documented quality option differs by API, and how to diagnose format and storage mismatches. For the exact API and version behavior, use the Apify page methods guide and the relevant SDK reference.

1. Choose a format and quality setting

Need Choice What to know
Keep the Puppeteer default PNG page.screenshot() defaults to PNG. Use a PNG content type and filename when saving its bytes.
Request JPEG output JPEG Set type: 'jpeg'. Save with a JPEG content type and a .jpg key or filename.
Adjust quality through the documented Apify utility saveSnapshot quality The SDK 2.3 reference documents screenshotQuality from 0 to 100, default 50. This is specific to that utility and version.

The sources do not establish a universal best quality value or a fixed file-size reduction. Image dimensions, page content, encoding and downstream use all matter. Pick a format your consumer accepts, then compare representative outputs at the settings supported by your actual API.

2. Capture and store a PNG in an Apify Actor

The JavaScript SDK 3.6 guide demonstrates capturing a buffer with Puppeteer and saving it in the Actor key-value store using Actor.setValue. This runnable pattern assumes your Actor has an initialized Apify SDK Actor and a Puppeteer page available as page:

const screenshot = await page.screenshot();

await Actor.setValue('screenshot.png', screenshot, {
  contentType: 'image/png',
});

With no type option, Puppeteer returns PNG. The key ends in .png, and the content type describes PNG data. Consult the Apify SDK 3.6 screenshot guide for its Actor setup and version-specific details.

3. Capture and store JPEG

To request JPEG, set type: 'jpeg' and keep the storage metadata consistent with the encoded bytes:

const screenshot = await page.screenshot({
  type: 'jpeg',
});

await Actor.setValue('screenshot.jpg', screenshot, {
  contentType: 'image/jpeg',
});

Puppeteer’s screenshot API and the Apify examples document the format choice and matching content type pattern. If your installed Puppeteer version or Actor wrapper differs, follow that version’s API documentation.

4. Set quality with saveSnapshot when supported

The Apify SDK 2.3 API reference documents screenshotQuality for puppeteer.saveSnapshot, with a default of 50 and allowed values from 0 through 100. Higher values create larger images and require more storage. This is not a universal quality option for every call to page.screenshot(); do not assume that passing this property to another screenshot method changes its encoding.

// SDK 2.3 utility example: use only where this utility is available.
await puppeteer.saveSnapshot(page, {
  key: 'snapshot',
  screenshotQuality: 75,
});

Check the exact method signature in the Apify SDK 2.3 puppeteer reference. For an Actor using another SDK or a different utility, use that installed version’s docs; do not carry this option over without confirming support.

5. Store screenshots where your Actor expects them

Apify commonly uses a key-value store for files and other unstructured output, while datasets are generally for structured records. The exact output location and key are Actor-specific, so check the Actor README and its run output instructions. When saving a screenshot, align all three items:

  • The bytes must actually be encoded in the selected format.
  • The content type must match the bytes, such as image/png or image/jpeg.
  • The key or filename extension should match, such as .png or .jpg.

See Apify’s input and output documentation for storage concepts and Actor-specific output guidance.

6. Compare quality settings for your use case

  1. Choose pages representative of your real workload, including the dimensions and content types you capture.
  2. Capture them using the format and supported quality values relevant to your method.
  3. Inspect the outputs at the size and scale at which they will be consumed.
  4. Record file sizes and whether details important to your workflow remain legible.
  5. Choose the smallest output that still meets that workflow’s visual and compatibility needs, then verify it on additional representative pages.

This is a suggested evaluation workflow, not a measured benchmark or a claim that one value is optimal. Higher saveSnapshot quality has a documented storage tradeoff; the sources do not give a universal size or fidelity curve.

7. Troubleshooting

Symptom Likely cause Fix
The output is PNG even though JPEG was expected The screenshot method defaults to PNG, or the wrapper did not pass the type option. For Puppeteer, pass type: 'jpeg' to page.screenshot(); confirm the Actor calls that method and that its installed version supports the option.
The file is mislabeled or will not display The extension or content type does not match the encoded image bytes. Match the encoding, storage content type and key extension: PNG with image/png and .png; JPEG with image/jpeg and .jpg.
Changing screenshotQuality has no effect The property belongs to the documented SDK 2.3 saveSnapshot utility, not every screenshot API. Confirm the precise method and installed SDK version. Use only the quality option documented for that method.
Quality value is rejected or outside the expected range The value is outside the 0–100 range documented for SDK 2.3 saveSnapshot, or a different method is being called. Use an integer from 0 through 100 for that utility and verify the method signature for your installed version.
Screenshot is missing from the run output The Actor may save it under a different key or storage location than expected. Check the Actor README and run output instructions. Confirm that the save operation completed and inspect the key-value store or output location the Actor documents.
Stored output uses more space than expected Higher documented saveSnapshot quality produces larger images; image dimensions and content also affect output size. Compare representative outputs with lower supported quality settings or another accepted format. Inspect visual requirements before adopting a smaller output.

8. Performance, reliability and cost notes

Image format and quality affect the image bytes that must be stored and later transferred. The Apify reference specifically says higher saveSnapshot quality means larger images and more storage. The available sources do not provide capture-time benchmarks, storage prices, or a universal PNG-versus-JPEG size ratio, so estimate using your own Actor outputs and current platform plan details.

For reliable downstream processing, keep the content type and extension consistent, use the Actor’s documented output store, and make the format acceptable to the next system in your pipeline. If an Actor or SDK version changes, recheck the screenshot method and utility options instead of assuming settings are global.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request returns a PNG, JPEG, WebP or PDF. Its API accepts screenshot options, and its docs describe the request parameters and behavior.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo API documentation

ScreenshotNeo accepts cookie and consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets before capture; each cleanup step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing, and each response identifies the page verdict and billing status in headers. Its MCP server gives AI agents tools for screenshots, page information and PDF capture. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots. Every feature is on every plan.

Sign up for ScreenshotNeo and get 1,000 screenshots a month free, with no card.

FAQ

Does page.screenshot() default to PNG?

Yes. The Apify page-methods guidance documents PNG as the default; use type: 'jpeg' to request JPEG.

Can I use screenshotQuality with every Puppeteer screenshot?

No such universal behavior is established by these sources. The 0–100 range and default of 50 are documented for Apify SDK 2.3’s puppeteer.saveSnapshot utility.

Where should I save the image?

Apify commonly uses a key-value store for file output, but the Actor determines its output key and location. Check that Actor’s README.