1

What is the correct term for the characters seen here?

data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBhQSERUUExQVFRUWGRwaGBgYGB0dGxkcHxccGxocGxoYHCYgGxojHBsdHy8gJCgpLSwsGB4xNTAqNSYrLCkBCQoKDgwOGg8PGiklHx8pLCwpKSkpKSwpLCkpKSwpLCksKSwsLCkpKSkpLCkpKSwpLCwsKSwsLCksKSkpKSksKf/AABEIAJ0BQQMBIgACEQEDEQH/xAAcAAACAwEBAQEAAAAAAAAAAAAEBQIDBgEABwj/xABFEAACAQIEBAQDBgMGAwcFAAABAhEDIQAEEjEFQVFhBhMicTKBkRRCobHB8CNS0QcVM1Ni4RaS8TRygpOiwtIkQ1RVY//EABoBAAIDA..

Is this a string representation of binary data? String representation of an image?

David Savage
  • 1,562
  • 2
  • 18
  • 35

3 Answers3

3

That is called a Data URI. It is a technique used to inline data directly into a HTML document rather than requiring a separate request to fetch a file.

The characters are a Base64 encoding of binary data - in this case it is data for an image.

Mark Byers
  • 811,555
  • 193
  • 1,581
  • 1,452
1

Is this a string representation of binary data? String representation of an image?

Yes. This is a data URI, composed of two parts - a header telling the type of data and the data itself (a base64 encoded binary).

Oded
  • 489,969
  • 99
  • 883
  • 1,009
0

The image in encoded in base64.

Base64 encoding takes three bytes, each consisting of eight bits, and represents them as four printable characters in the ASCII standard. It does that in essentially two steps.

The first step is to convert three bytes to four numbers of six bits. Each character in the ASCII standard consists of seven bits. Base64 only uses 6 bits (corresponding to 2^6 = 64 characters) to ensure encoded data is printable and humanly readable. None of the special characters available in ASCII are used. The 64 characters (hence the name Base64) are 10 digits, 26 lowercase characters, 26 uppercase characters as well as '+' and '/'.

If, for example, the three bytes are 155, 162 and 233, the corresponding (and frightening) bit stream is 100110111010001011101001, which in turn corresponds to the 6-bit values 38, 58, 11 and 41.

From Base64

Kirell
  • 9,228
  • 4
  • 46
  • 61