Recognize the prefix required by an HTML image
Example input
badge.pngExpected result
data:image/png;base64,…The abbreviated output illustrates the prefix, not a complete image. Copy the full generated value into a src attribute or the contents of a CSS url function. Bare Base64 bytes without the media-type prefix are not a complete data URI. A 3,000-byte input needs 4,000 Base64 characters before the prefix; encoding does not compress the image.