Gathering detailed insights and metrics for blueimp-canvastoblob
Gathering detailed insights and metrics for blueimp-canvastoblob
Gathering detailed insights and metrics for blueimp-canvastoblob
Gathering detailed insights and metrics for blueimp-canvastoblob
JavaScript Canvas to Blob is a function to convert canvas elements into Blob objects.
npm install blueimp-canvastoblob
Typescript
Module System
NPM Version
JavaScript (91.01%)
HTML (7.01%)
Shell (1.98%)
Total Downloads
198,459
Last Day
120
Last Week
499
Last Month
2,776
Last Year
48,029
MIT License
1,475 Stars
151 Commits
395 Forks
66 Watchers
2 Branches
8 Contributors
Updated on May 04, 2025
Minified
Minified + Gzipped
Latest Version
2.1.0
Package Id
blueimp-canvastoblob@2.1.0
Size
5.43 kB
NPM Version
1.4.9
Published on
Aug 18, 2014
Cumulative downloads
Total Downloads
Last Day
900%
120
Compared to previous day
Last Week
-4.2%
499
Compared to previous week
Last Month
-34.6%
2,776
Compared to previous month
Last Year
-7%
48,029
Compared to previous year
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.
Include the (minified) JavaScript Canvas to Blob script in your HTML markup:
1<script src="js/canvas-to-blob.min.js"></script>
Then use the canvas.toBlob() method in the same way as the native implementation:
1var canvas = document.createElement('canvas'); 2/* ... your canvas manipulations ... */ 3if (canvas.toBlob) { 4 canvas.toBlob( 5 function (blob) { 6 // Do something with the blob object, 7 // e.g. creating a multipart form for file uploads: 8 var formData = new FormData(); 9 formData.append('file', blob, fileName); 10 /* ... */ 11 }, 12 'image/jpeg' 13 ); 14}
The JavaScript Canvas to Blob function has zero dependencies.
However, Canvas to Blob is a very suitable complement to the JavaScript Load Image function.
In addition to the canvas.toBlob polyfill, the JavaScript Canvas to Blob script provides one additional function called dataURLtoBlob, which is added to the global window object if no AMD loader is used to load the script:
1// 80x60px GIF image (color black, base64 data): 2var b64Data = 'R0lGODdhUAA8AIABAAAAAP///ywAAAAAUAA8AAACS4SPqcvtD6' + 3 'OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofE' + 4 'ovGITCqXzKbzCY1Kp9Sq9YrNarfcrvcLDovH5PKsAAA7', 5 imageUrl = 'data:image/gif;base64,' + b64Data, 6 blob = window.dataURLtoBlob && window.dataURLtoBlob(imageUrl);
The following browsers support either the native or the polyfill canvas.toBlob() method:
JavaScript Canvas to Blob Test
The JavaScript Canvas to Blob script is released under the MIT license.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
9 existing vulnerabilities detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More