October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

How to Reduce Cypress Screenshot File Size

Capture less with Cypress, then test lossless or lossy PNG optimization on copies. Learn what screenshot settings do—and do not—control.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To reduce Cypress screenshot storage, first capture only the page area you need; then, if necessary, optimize PNG files after capture. Cypress’s documented screenshot options do not include a compression-quality setting, so image compression requires an external tool. Keep failure screenshots if your team relies on them to diagnose CI problems, and validate any lossy optimization before using images as visual-test evidence.

1. Avoid captures you do not need

Cypress can take screenshots explicitly with cy.screenshot() and can capture automatically when a test fails during cypress run. Automatic failure capture is enabled by default; set screenshotOnRunFailure to false if your workflow does not need those files.

As an Amazon Associate I earn from qualifying purchases.

const { defineConfig } = require('cypress')

module.exports = defineConfig({
  screenshotOnRunFailure: false,
})

This setting affects automatic failure screenshots only. It does not stop explicit calls to cy.screenshot(). Before disabling it, consider whether developers use those captures to investigate CI failures: fewer files also means less diagnostic evidence.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Capture a smaller area

If the test concerns one component, take an element screenshot instead of capturing the whole page:

#1 Best Overall
Sandisk 2TB Extreme Portable SSD, Up to 1050MB/s, USB-C, USB 3.2 Gen 2, IP65 Water and Dust Resistance, Updated Firmware, External Solid State Drive, SDSSDE61-2T00-G25
  • Get NVMe solid state performance with up to 1050MB/s read and 1000MB/s write speeds in a portable, high-capacity drive(1) (Based on internal testing; performance may be lower depending on host device & other factors. 1MB=1,000,000 bytes.)
  • Up to 3-meter drop protection and IP65 water and dust resistance mean this tough drive can take a beating(3) (Previously rated for 2-meter drop protection and IP55 rating. Now qualified for the higher, stated specs.)
  • Use the handy carabiner loop to secure it to your belt loop or backpack for extra peace of mind.
  • Help keep private content private with the included password protection featuring 256‐bit AES hardware encryption.(3)
  • Easily manage files and automatically free up space with the SanDisk Memory Zone app.(5). Non-Operating Temperature -20°C to 85°C
cy.get('[data-cy=checkout-summary]').screenshot('checkout-summary')

Use a selector that identifies the relevant element reliably. Cypress also documents crop support, but screenshot options can vary by capture mode and Cypress version. Check the screenshot command documentation for the version installed in your project before applying crop options.

Reserve full-page capture for full-page questions

A full-page capture scrolls through the page and stitches sections together. That is useful when the issue spans the page, but it includes more image area than a focused component screenshot. Avoid capture: 'fullPage' when the diagnostic question concerns only a small region.

Rank #2
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
  • Solid state performance with up to 800MB/s read speeds in a portable drive. (Based on internal testing; performance may be lower depending on host device, interface, usage conditions and other factors. 1MB=1,000,000 bytes.)
  • Back up your content and memories on a storage solution that fits seamlessly into your mobile lifestyle.
  • Take it with you on your adventures—up to two-meter drop protection means this durable drive can take a beating. (Based on internal testing.)
  • Secure it to your belt loop or backpack for extra peace of mind thanks to the tough rubber hook.
  • From Sandisk, a brand professional photographers trust to take on assignments.

3. Distinguish file size from retained artifact count

Cypress clears the configured screenshots folder before cypress run by default. Setting trashAssetsBeforeRuns: false changes whether prior assets are retained; it does not compress screenshots. If the directory is growing across runs, check this cleanup setting separately from the byte size of each PNG.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Optimize PNGs after capture

Cypress’s documented screenshot API does not expose a screenshot compression-quality control. If reducing the bytes of existing captures matters, post-process copies and compare their sizes and appearance before changing your pipeline.

Rank #3
Sale
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Try lossless optimization first

OptiPNG attempts to reduce PNG size without semantic loss. It may produce no savings for a particular file, so do not assume every screenshot will shrink. Preserve the original and inspect the output before replacing anything.

Use lossy palette reduction only when acceptable

pngquant reduces the number of colors in a PNG and is lossy. Its --quality=min-max option lets you set a quality range. Color changes may be visible in gradients, antialiasing, and color-rich interfaces, and can cause pixel-diff tests to fail. Keep originals and validate representative outputs in the same visual-testing workflow that consumes them.

Rank #4
Sale
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
  • NEARLY 2X FASTER THAN OUR PREVIOUS GENERATION(8) – move 1,000 high-res photos in under 60 seconds(6) with up to 2000MB/s transfer speeds(2).
  • IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.
  • POCKET-SIZED – fits easily in pockets and small bags.
  • SPACE TO OWN YOUR AI CONTENT – speed and capacity to download your high-res clips and photo edits.
  • 256-BIT AES ENCRYPTION(4) – helps keep private files secure with password protection.

5. Measure the result in your own workflow

  1. Choose representative screenshots, including complex pages and failure cases.
  2. Keep an untouched copy of each original.
  3. Compare original and processed byte counts; savings are not guaranteed.
  4. Inspect the processed images at normal viewing size and compare them with your originals.
  5. Run the actual debugging or visual-diff workflow that uses these files before adopting the optimization.

No universal reduction percentage is established for Cypress screenshots. The result depends on the image and the optimizer settings.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshooting common approaches

  • Failure screenshots still appear after setting screenshotOnRunFailure: false: check for explicit cy.screenshot() calls. The setting controls automatic captures on failure, not manual ones.
  • The screenshots folder keeps growing: check whether trashAssetsBeforeRuns is disabled. That setting affects retention across runs, not individual image compression.
  • A full-page image is much larger than expected: use an element capture or supported crop when the test only needs a smaller region.
  • PNG optimization does not change the file: lossless optimization may not find a smaller encoding for that image. Compare bytes rather than assuming a saving.
  • Visual tests fail after pngquant: palette reduction can change pixels. Restore the original or adjust the visual-testing process only if those differences are acceptable for your use case.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a screenshot from a URL rather than a Cypress test artifact, ScreenshotNeo is a website screenshot API and MCP server. Its one-call API can return an image or PDF:

Quick Recap

Bestseller No. 2
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
From Sandisk, a brand professional photographers trust to take on assignments.
$165.70
SaleBestseller No. 3
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$129.99
SaleBestseller No. 4
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.; POCKET-SIZED – fits easily in pockets and small bags.
$249.17
Bestseller No. 5
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$229.95
Best Value
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
  • Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for options. It removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed; and an MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month, with no card.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.