How to Hide Cookie Banners in Cloudinary Website Screenshots
Cloudinary URL2PNG documents screenshot and image transformation options, but no cookie-banner dismissal control. Here are practical ways to capture the intended page state.
Short answer: Cloudinary’s URL2PNG Website Screenshots documentation does not list a dedicated option to dismiss or hide a website’s cookie banner before capture. Its documented capture options include viewport, user agent, delay, and full-page behavior. Cloudinary image transformations can crop or cover pixels after capture, but that does not interact with the source page’s consent manager. Cloudinary URL2PNG documentation · Cloudinary cropping documentation
If the screenshot must reflect a real consent choice, interact with the target site’s consent interface before capturing, using a browser workflow that can preserve the intended state. For repeated captures, automate that interaction or use an explicitly controlled test state, then capture the page. Test against the site and consent manager you actually use: Cloudinary’s reviewed documentation does not establish how URL2PNG handles third-party consent cookies or banner state.
1. Choose what “hide” means
There are two different outcomes developers may mean:
- Record a consent choice and capture the resulting page: interact with the consent manager using its accept, reject, or preference controls. This is the right approach when the captured page needs to reflect a particular consent state.
- Make the banner absent from the image: use a test state or page styling in a browser capture flow, or crop/cover the screenshot after capture. This changes what appears in the image; it does not record consent.
Do not infer consent from a screenshot with no visible banner. If you are capturing a third-party site, follow that site’s permitted access and testing practices.
2. What Cloudinary URL2PNG can and cannot do
URL2PNG is a Cloudinary add-on for dynamically generating screenshots of public websites and delivering them through Cloudinary’s image pipeline. The documented URL2PNG options include viewport, user_agent, and delay; the documentation also shows the fullpage option. It does not list a banner-dismissal switch or source-page CSS injection option. That is a statement about the reviewed documentation, not proof that no private or later-added capability exists. Check the current add-on interface and account settings before relying on a particular behavior. URL2PNG options and setup
Cloudinary’s documentation describes image transformations such as cropping and overlays on the screenshot image. Those operations occur in the image pipeline; they do not click the consent UI, set a target-site preference, or prove that a consent choice was recorded. Cloudinary image layers
3. Set up a browser capture that handles consent
For a repeatable capture, use browser automation to load the page, explicitly interact with the consent control, verify the banner has gone, and save the resulting screenshot. The following Node.js example uses Playwright. The selectors are intentionally site-specific placeholders: inspect the target page and replace them with the actual consent button and banner selectors.
npm install playwright
npx playwright install chromium
// capture.mjs
import { chromium } from 'playwright';
const target = process.env.TARGET_URL ?? 'https://example.com';
const acceptSelector = process.env.CONSENT_ACCEPT_SELECTOR;
const bannerSelector = process.env.CONSENT_BANNER_SELECTOR;
if (!acceptSelector || !bannerSelector) {
throw new Error('Set CONSENT_ACCEPT_SELECTOR and CONSENT_BANNER_SELECTOR for the target site.');
}
const browser = await chromium.launch({ headless: true });
const context = await browser.newContext({ viewport: { width: 1440, height: 1000 } });
const page = await context.newPage();
try {
await page.goto(target, { waitUntil: 'domcontentloaded', timeout: 45000 });
await page.locator(acceptSelector).waitFor({ state: 'visible', timeout: 10000 });
await page.locator(acceptSelector).click();
await page.locator(bannerSelector).waitFor({ state: 'hidden', timeout: 10000 });
await page.screenshot({ path: 'page.png', fullPage: true });
} finally {
await browser.close();
}
Run it with selectors chosen for the specific site:
TARGET_URL='https://example.com' \
CONSENT_ACCEPT_SELECTOR='button#accept' \
CONSENT_BANNER_SELECTOR='#cookie-banner' \
node capture.mjs
This example accepts the site’s consent prompt; change the selector and interaction to make the choice your workflow requires. Some consent managers use iframes, shadow DOM, delayed rendering, or different controls by region. In those cases, adapt the locator and wait logic, and verify the resulting state rather than assuming the click succeeded. If your organization needs a test-only state, use a state or styling mechanism that the site explicitly supports.
4. Use URL2PNG for capture, then transform the image if appropriate
Once the target page is in the desired state, URL2PNG can generate a screenshot through Cloudinary. Cloudinary requires an account and add-on registration. Its documentation says URL2PNG delivery URLs generally need to be signed or eagerly generated by default; an account can optionally allow unsigned transformations for selected add-ons. Check your account’s current security settings and signing requirements before deploying. Cloudinary setup, URL structure, and signing
The URL2PNG documentation shows options encoded in a public ID in this general form:
<Website URL>/url2png/viewport=1440x1000|fullpage=false|delay=2
That syntax illustrates capture configuration only; it does not dismiss a banner. Use the current Cloudinary documentation and SDK/API flow to build and sign the full delivery URL for your account. Avoid placing account secrets in client-side code.
If your only requirement is to keep a banner out of a composed image, crop the screenshot when the layout allows it. An overlay can cover pixels, but may obscure page content and can be misleading if presented as a consent-handled capture. Cropping or overlays do not change the source page or its consent state.
5. Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. It accepts and removes known consent banners, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in headers. AI agents can use its MCP tools to take screenshots, get page information, and capture PDFs.
One request returns the screenshot. See the ScreenshotNeo API documentation for parameters and configuration.
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,
)
r.raise_for_status()
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}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
const image = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', image));
ScreenshotNeo includes full-page capture, selector-based element capture, viewport and device presets, custom CSS and JavaScript, wait conditions, headers, cookies, caching, signed public image links, asynchronous jobs, bulk capture, and PDF output. It supports the parameter names used by other screenshot APIs to make migration easier. Plans include 1,000 screenshots per month free with no card; paid plans start at $5 for 3,000 screenshots, and all features are available on every plan.
Create a free ScreenshotNeo account for 1,000 screenshots a month, with no card required.
6. Troubleshooting
| Symptom | Likely cause | What to do |
|---|---|---|
| The banner remains in the URL2PNG image | The documented URL2PNG options do not provide a banner dismissal control. | Handle consent in a browser workflow before capture, or use a service with documented consent handling. Verify actual target-site behavior. |
| A banner is hidden but the screenshot implies consent | Visual removal was confused with recording a choice. | Use the site’s consent interface or an explicitly supported test state. Treat cropping, overlays, and CSS as visual changes only. |
| Playwright times out waiting for the button | The selector is wrong, the banner is delayed, or the control is inside an iframe or shadow DOM. | Inspect the live DOM, wait for the correct frame or element, and use a locator supported by the target’s structure. |
| The click runs but the banner stays visible | The click may hit a non-interactive element, the control may require another step, or the site may re-render the banner. | Confirm the selected control and wait for the banner’s hidden state; handle preference dialogs and nested frames explicitly. |
| Cloudinary rejects or does not deliver a URL2PNG transformation | The add-on may not be registered, or the URL may need signing/eager generation under account security settings. | Check add-on registration, current signing requirements, and unsigned add-on settings in the Cloudinary Console. |
| The crop removes useful page content | The banner overlaps the content or the crop is not appropriate for the layout. | Capture after consent handling, or choose a crop that preserves the information readers need. |
7. Performance, reliability, and cost considerations
- Wait for the right condition: A fixed delay can make a page appear ready but does not prove the consent manager finished loading. In browser automation, wait for the actual control and the banner’s resulting state. URL2PNG documents a delay option; tune it against the target site.
- Make captures reproducible: Use a consistent viewport and user agent, and keep the consent interaction or test state explicit. A page can vary by region, session, or consent-manager configuration.
- Protect credentials: Cloudinary’s URL2PNG URLs may require signatures or eager generation. Keep signing secrets server-side and review account security settings before exposing transformations.
- Budget for the workflow: The reviewed Cloudinary documentation establishes add-on registration and access controls, but does not establish current pricing or plan entitlement. Confirm those details in your account. ScreenshotNeo’s listed plans are $0 for 1,000 monthly shots, then $5 for 3,000, $15 for 15,000, $39 for 60,000, $99 for 250,000, and $249 for 1,000,000; yearly billing gives two months free.
FAQ
Does Cloudinary URL2PNG have a cookie-banner hide option?
The reviewed official URL2PNG documentation does not list one. Check the current add-on interface for later changes, and test the exact site you need to capture.
Does a Cloudinary cookie setting control cookies on the website being captured?
No such behavior is established by the reviewed Cloudinary cookie documentation. It describes Cloudinary-related cookie handling; it does not explain consent state for arbitrary third-party sites. Cloudinary cookie documentation
Can a Cloudinary crop or overlay remove the banner?
It can change the delivered image’s visible pixels, subject to framing and content. It does not interact with the source site’s consent controls or record consent.


