Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

blueimp-canvas-to-blob

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blueimp-canvas-to-blob

Canvas to Blob is a polyfill for the standard JavaScript canvas.toBlob method. It can be used to create Blob objects from an HTML canvas element.

  • 3.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is blueimp-canvas-to-blob?

The blueimp-canvas-to-blob npm package is a JavaScript library that provides a polyfill for the standard HTML5 canvas.toBlob method. This method allows you to convert canvas elements to Blob objects, which can then be used for file uploads, image processing, and other tasks that require binary data.

What are blueimp-canvas-to-blob's main functionalities?

Convert Canvas to Blob

This feature allows you to convert a canvas element to a Blob object. The code sample creates a canvas, draws a red rectangle on it, and then converts the canvas to a Blob object in PNG format.

const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
ctx.fillStyle = 'red';
ctx.fillRect(10, 10, 100, 100);
canvas.toBlob(function(blob) {
  console.log(blob);
}, 'image/png');

Specify Image Type and Quality

This feature allows you to specify the image type and quality when converting a canvas to a Blob. The code sample creates a canvas, draws a blue rectangle on it, and then converts the canvas to a JPEG Blob with 75% quality.

const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
ctx.fillStyle = 'blue';
ctx.fillRect(10, 10, 100, 100);
canvas.toBlob(function(blob) {
  console.log(blob);
}, 'image/jpeg', 0.75);

Other packages similar to blueimp-canvas-to-blob

Keywords

FAQs

Package last updated on 27 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc