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

Set crossOrigin on the HTMLImageElement before assigning its src, and make the image server return a matching Access-Control-Allow-Origin header. Use anonymous when the image needs no cross-origin credentials; use use-credentials only when cookies or other credentials are required and the server explicitly permits them. Setting crossOrigin on the canvas does not authorize an image.

What crossOrigin controls

HTMLImageElement.crossOrigin reflects the image’s crossorigin content attribute. It selects how a cross-origin image request is made; it does not grant permission by itself. The image origin must also opt in with an appropriate CORS response header.

anonymous: CORS without cross-origin credentials

anonymous makes a CORS request while omitting credentials for a cross-origin load. This is the normal choice for public images that you want to draw into a readable canvas.

use-credentials: CORS with credentials

use-credentials makes a CORS request with credentials included. Cookies, client certificates, and authorization credentials may be sent. The server must return Access-Control-Allow-Credentials: true and an origin-specific Access-Control-Allow-Origin value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
ESRICH Acrylic Paint Canvas Set, 52 PCS Painting Supplies Kit
  • 【Painting Set】: The set has 2 wood easels(11in), 2*10 PCS brushes, 2 PCS 12 color tubes (12ml, 0.4 oz) acrylic paint, 2 palettes, 2 PCS 8”*10” and 2 PCS 8” * 8”round canvas and a gift box.
  • 【High-Quality Paint Set】: Featuring vibrant, safe, and user-friendly acrylic paints, a foldable wooden tabletop easel, individually wrapped high-quality nylon-bristle brushes, and 100% pure cotton, acid-free canvas with palettes—all built for lasting durability.
  • 【Versatile Use】: This painting set comes with vibrant acrylic paints, brushes, easels, palettes, and canvas, Perfect for couple's date nights, family activities, parties, group projects, and more, it lets you enjoy happy painting moments with friends and loved ones.
  • 【Perfect Gift】: This painting kit comes in an exquisite gift box, making it an ideal choice for beginners, art lovers, children, and adults. They can explore the wonderful world of paints. A Wonderful gift for friends and family who enjoy creating
  • 【Contact Us】:Your satisfaction is our top priority—buy with confidence. If you are not completely satisfied with our product or have any questions, please do not hesitate to contact us.

Missing, empty, or invalid values

If the attribute is missing, the request uses the No CORS state. An empty or invalid value uses the anonymous state. These are different outcomes: an omitted attribute does not ask the server for CORS permission, while crossorigin="anonymous" does.

Apply it before the image request starts

HTML markup

Put the attribute on the image element that will be drawn. The browser reads it when it starts loading src.

<img crossorigin="anonymous" src="https://cdn.example.com/photo.jpg" alt="">

For credentialed loading:

<img crossorigin="use-credentials" src="https://private.example.com/photo.jpg" alt="">

JavaScript

Assign crossOrigin first, then assign src. The following example waits for the image, draws it, and reads pixels:

Rank #2
8 Pack 8 * 10In Canvas Boards for Painting, Art Canvas for Drawing with 16 Brushes & 8 Paint Trays & 16 Acrylic Paint, Mini Painting Canvas with Easel Set, Painting Kits for Adults Party
  • 56-PIECE CANVAS SET: Pomaylor painting set has 56 pieces. You can get 8 canvases(8''*10''), 8 easels(9.4''*7.09''), 16 brushes(6.49''), 8 color palettes(5.11'') and 16 acrylic paint(6.5'') for painting at one time. The set contains a large number of canvases and easels that can be used many times. The brushes in the set come in two different sizes, which can help you achieve different painting requirements
  • 100% COTTON CANVAS: Pomaylor painting canvas is 100% cotton canvas, suitable for oil, acrylic, gouache, watercolor and other paints, easy to color and will not bleed. The boards are sturdy and will not warp, the canvas is handmade and taut by experienced craftsmen for a tight, flat texture
  • SOLID PINE WOOD EASEL: Our easels are made from solid pine wood, which has a beautiful wood grain. The surface of the easel is polished very smooth. The easel is easy to store and carry, it can not only support the drawing board, but also be used as a cell phone holder, display stand, etc
  • CUTE AND PORTABLE SIZE: The canvases included in our set are 8'' * 10'' mini canvases, which are very cute and perfect to carry when you go out, making sketching less tiring
  • SUITABLE FOR MULTIPLE SCENES: The canvas and easel included in the set can support up to 8 people party use. Can be used for individual artistic painting, family interaction, couple games and other activities, the easel, trays and brushes can be reused, each board is individually packaged, do not have to worry about whether you need to use it all at once
const img = new Image();
img.crossOrigin = "anonymous"; // set before src
img.onload = () => {
  const canvas = document.querySelector("canvas");
  const ctx = canvas.getContext("2d");
  ctx.drawImage(img, 0, 0);
  const pixels = ctx.getImageData(0, 0, canvas.width, canvas.height);
  console.log(pixels.data.length);
};
img.onerror = (event) => {
  console.error("Image failed to load", event);
};
img.src = "https://cdn.example.com/photo.jpg";

Changing crossOrigin after src has started loading cannot change that request. Set the property before every new load, or create a new Image object.

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

The image server must authorize your page

For a cross-origin image to remain usable for readable canvas pixels, the response must contain Access-Control-Allow-Origin matching the origin of the page making the request. The browser-side attribute cannot manufacture this permission. If the server does not authorize the requesting origin, the browser may block the load or make the image unusable for pixel reads.

Anonymous response

A public image loaded with anonymous needs an Access-Control-Allow-Origin response value that matches your page origin. The exact origin is safer when access is intended for a known site.

Rank #3
ESRICH 26 PCS Acrylic Paint Set with 12 Colors Acrylic Paints
  • 【Ultra Practical Paint Set】: The painting kits have 10pcs brushes,12 color acrylic paint (12ml, 0.4 oz) , 2 Canvas Panels, 1 wood easel and 1 plate. Everyone can enjoy the fun of painting!
  • 【 High Quality Acrylic Paint 】: Our paint adopts a unique formula and high-quality pigments, which can bring maximum brightness and color clarity. They have professional artist qualities, perfect for blending, layering, and creating texture.
  • 【10 Multi-functional Brushes】: The brushes soft hair, good adsorption, hard and straight pen holder. There are 10 different sizes, including square, fan and round, which are suitable for various painting skills.
  • 【 Widely used 】: The paint can be used in most art and craft technologies, are used in canvas, ceramics, wood, fabrics, clay, walls, nails, crafts, ,paper, chalk board etc. Our acylic paint conforms to ASTM D-4236 certificate. They are non-toxic and harmless.
  • 【Canvas Panel and Metal Easel】:There are 2 pcs 6 * 8 inch canvas and 1 wood easel in this painting kit. Complete all painting equipment for you at once. The easel can be used as an easel when painting, also a multifunctional mobile phone stand and other functions. Let's enjoy painting together.

Credentialed response

With use-credentials, return both an origin-specific Access-Control-Allow-Origin and Access-Control-Allow-Credentials: true. A wildcard allow-origin configuration is not compatible with credentialed sharing. The server must also be prepared to authenticate the request using the credentials it receives.

Check the actual response

Inspect the image request in browser developer tools, not just the HTML. In the Network panel, open the response headers and verify the allow-origin value, and for credentialed requests verify the allow-credentials header. The Console usually reports the CORS reason when the browser rejects the response.

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

Why the canvas becomes tainted

When foreign-origin image data is drawn without successful CORS approval, the canvas becomes tainted. A tainted canvas protects those pixels from script. Calls that read or export the bitmap then throw a SecurityError:

Rank #4
Nicpro 68PCS Acrylic Paint Canvas Set for Adults with 24 Paint for Beginner
  • Complete Art Painting Kit: The painting kits for adults includes: 24 colors acrylic paint, 12 paint brushes, 8 canvas panels, table easel, 16 sheets 8"x10" painting paper, plastic palette, cleaning cup, 2 palette knife, 2 painting sponge and color wheel, one painting set satisfy all your creative needs
  • Canva Panels & Painting Pad: There are 8pcs 8"x10” canvas panels in the paint kits for adults, 100% cotton canvas surface, meeting your needs of creative painting. 16 Sheet of 8"x10" acrylic painting paper with high quality material and thick texture
  • Acrylic Paint & Table Easel: 24 artist grade vivid colors with buttery consistency for easy mixing and coloring (12 ml / 0.4 fl.oz). And the multi-functional table easel is lightweight and foldable, easy to carry. It can be used for table top painting, also display stand for painting, ipad or crafts
  • Paint Brushes & Cleaning Cup: Made of synthetic nylon hair, 12 different shapes and sizes paint brushes provide different functions, cover all your painting needs. Also comes with silicone paint brush washer, collapsible and portable, both for painting cleaning cup and paintbrush holder
  • Enjoy Painting Time: This canvas painting kit includes all complete painting supplies you need, perfect for an artists, beginner, student or painters of all levels. Painting kits is a great gift choice for your friends and families who enjoy painting
  • getImageData()
  • toDataURL()
  • toBlob()
  • captureStream()

You can still see the drawn image on screen, which is why this problem often appears only when an export or pixel-processing operation runs. A same-origin image generally avoids this cross-origin taint path; a cross-origin image requires both the correct request mode and a successful server response.

Choose the correct mode

Situation Image setting Server requirement Result
Public image; no cross-origin cookies or credentials anonymous Matching Access-Control-Allow-Origin Readable canvas pixels when the response is authorized
Image requires cookies, client certificates, or authorization credentials use-credentials Matching allow-origin plus Access-Control-Allow-Credentials: true Credentialed CORS image that can be drawn and read when approved
Image is same-origin Usually no attribute is needed Same-origin policy applies Generally avoids the cross-origin taint path
Attribute omitted No CORS state No CORS authorization is requested by the image element Cross-origin pixels are not available for protected canvas reads

Use the least-privileged mode that satisfies the application. Do not choose use-credentials merely to make a CORS error disappear; it imposes stricter server requirements and sends credentials that the image may not need.

A reliable debugging procedure

  1. Confirm the element. Set img.crossOrigin on the exact HTMLImageElement being passed to drawImage. Setting a property on <canvas> has no authorization effect.
  2. Confirm ordering. In JavaScript, place img.crossOrigin = "anonymous" or "use-credentials" before img.src = .... In markup, keep crossorigin on the same image element as src.
  3. Reload after changing the mode. If a request already began, changing the property cannot retroactively alter it. Assign the new mode and load the URL again.
  4. Read the response headers. Check that Access-Control-Allow-Origin matches the page origin. For use-credentials, check Access-Control-Allow-Credentials: true as well.
  5. Reproduce the failing operation. Test getImageData, toBlob, toDataURL, or captureStream after onload. A visible image does not prove that its pixels are readable.
  6. Use the Console and Network panels together. The Console identifies a CORS failure; the Network response shows whether the server actually emitted the required headers.

Common errors and their fixes

Symptom Likely cause Fix
SecurityError from toDataURL() or getImageData() The canvas was tainted by an image loaded without successful CORS approval. Reload the image with crossOrigin set first, and configure the image server’s allow-origin response.
Console says the response lacks Access-Control-Allow-Origin The server did not opt in to the requesting page. Add a response header matching the page origin, then reload the image.
Credentialed request is rejected use-credentials is being used without Access-Control-Allow-Credentials: true, or the server uses an incompatible wildcard allow-origin. Return the specific requesting origin and Access-Control-Allow-Credentials: true, or switch to anonymous if credentials are unnecessary.
Changing crossOrigin appears to do nothing The image request had already started. Create or reload the image after setting the property; request mode is chosen when loading begins.
Image is visible but export fails Rendering and pixel authorization are separate; the canvas is tainted. Verify CORS headers and retest the export operation after a successful CORS load.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability, and security notes

  • Set the mode once before loading rather than starting a request and then replacing the image. This avoids work that cannot produce readable pixels.
  • Use anonymous for public assets whenever possible. Credentialed requests add cookie and authentication dependencies and require stricter response headers.
  • Keep the image host’s CORS policy aligned with the pages that actually embed it. An allow-origin value for the wrong site is equivalent to no authorization for your page.
  • Do not treat a successful onload event as proof that canvas export is permitted; perform the read or export operation that your application needs.
  • Only request credentialed sharing when the image server and your application have a clear need for credentials. This limits accidental exposure of authenticated image data.

Or skip the browser setup

If your goal is a rendered webpage screenshot rather than JavaScript access to cross-origin pixels inside your own canvas, ScreenshotNeo provides a one-request screenshot API. It handles the remote page capture on its servers, so you do not have to build a browser launch-and-CORS workflow for that use case. Before capture it accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off.

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

Only clean shots are billed. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and each response identifies the result with X-Page-Verdict and X-Billed headers. ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

Best Value
Nicpro 80PCS Acrylic Paint Canvas Set for Adults with 36 Paints (36ML)
  • Complete Painting Kit: The painting supplies set includes: 36 colors acrylic paint(36ml), 10 canvas panels in 3 sizes, table easel, 12 paint brushes, 16 sheets 8"x10" painting paper, plastic palette, cleaning cup, palette knife, painting sponge and color wheel, one painting set satisfy all your creative needs
  • Acrylic Paint & Table Easel: 36 artist grade vivid colors with buttery consistency for easy mixing and coloring, 36 ml / 1.2 fl.oz - larger volume than the other competitors. And the wooden table easel is lightweight and foldable, easy to carry. Not only for painting, but also for display your works
  • Canva Panels & Painting Pad: There are 3 sizes canvas panels in the adults painting kit, totally 10pcs, 100% cotton canvas surface, meeting your needs of creative painting. 16 Sheet of 8"x10" acrylic painting paper with high quality material and thick texture
  • Paint Brushes & Cleaning Cup: Made of synthetic nylon hair, 12 different shapes and sizes paint brushes provide different functions. Also comes with silicone paint brush washer, collapsible and portable, both for painting cleaning cup and paintbrush holder
  • Enjoy Painting Time: This acrylic paint and canvas set includes all complete painting supplies you need, perfect for an artists, beginner, student or painters of all levels. Painting kits for adults is a great gift choice for your friends and families who enjoy painting

cURL

See the ScreenshotNeo API documentation for all options.

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

Python

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)

Node.js

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(`${res.status} ${res.statusText}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

The service includes full-page capture with lazy images loaded, CSS-selector element capture, dark mode, device presets and custom viewports, retina scale, PDF controls, custom CSS and JavaScript, click and wait actions, request and resource blocking, headers, cookies, user agents, authorization, timezone and geolocation, transparent backgrounds, resizing, selectable cache TTLs, signed links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API, an OpenAPI specification, and compatibility with parameter names used by other screenshot APIs.

There is a free allowance of 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; yearly billing gives two months free, and every feature is available on every plan. Create a free ScreenshotNeo account to get started.

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

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.