Blob

Binary Large Object - an immutable object representing raw binary data in the browser, used for reading and writing image files in JavaScript.

A Blob (Binary Large Object) is an immutable object representing raw binary data in the browser's JavaScript environment. In image processing, Blobs hold image data from file inputs or Canvas output, enabling download and upload operations.

The File object inherits from Blob, so images selected via <input type="file"> are directly usable as Blobs. The Canvas API's toBlob() method converts rendered content into a Blob in the requested format, with PNG as the default. Formats such as JPEG and WebP depend on browser support, and an unsupported type falls back to PNG.

URL.createObjectURL(blob) generates a temporary URL for use in <img> elements or download links. The image compression tool uses blob.size to display file size comparisons. While an Object URL exists, its Blob cannot be garbage-collected. Object URLs are released via URL.revokeObjectURL(), and also when, for example, the page that created them goes away.

Related Terms

Related Articles