Browser-local limits
Canvas-based export is browser dependent. PNG is broadly available; JPEG/WebP quality and support can vary, and metadata may not be preserved through canvas re-encoding.
Base64 changes representation, not image quality
Encoding an image as Base64 preserves the source bytes but expands the binary payload by roughly one third before any data-URL prefix. The MIME type and prefix must still match the actual image format when the string is embedded in HTML, CSS, JSON, or another container.
Choose inline data deliberately
Data URLs can simplify very small self-contained assets, but large strings increase document or bundle size and can reduce normal browser caching benefits. Some environments also impose URL, source-file, or Content Security Policy limits. For ordinary photos and larger graphics, a separately cached file is often easier to maintain. Decode a copied Base64 payload and compare its bytes or rendered image when exact round-trip fidelity matters.