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 - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

2

package.json
{
"name": "blueimp-canvas-to-blob",
"version": "3.2.0",
"version": "3.2.1",
"title": "JavaScript Canvas to Blob",

@@ -5,0 +5,0 @@ "description": "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.",

@@ -29,4 +29,4 @@ /*

function (newBlob) {
expect(newBlob).to.be.a(Blob)
done()
expect(newBlob).to.be.a(Blob)
}

@@ -41,4 +41,4 @@ )

function (newBlob) {
expect(newBlob.type).to.be('image/png')
done()
expect(newBlob.type).to.be('image/png')
},

@@ -54,4 +54,4 @@ 'image/png'

function (newBlob) {
expect(newBlob.type).to.be('image/jpeg')
done()
expect(newBlob.type).to.be('image/jpeg')
},

@@ -68,5 +68,5 @@ 'image/jpeg'

window.loadImage(newBlob, function (img) {
done()
expect(img.width).to.be(canvas.width)
expect(img.height).to.be(canvas.height)
done()
})

@@ -87,5 +87,5 @@ }

.getImageData(0, 0, newCanvas.width, newCanvas.height)
done()
expect(canvasData.width).to.be(newCanvasData.width)
expect(canvasData.height).to.be(newCanvasData.height)
done()
}, {canvas: true})

@@ -92,0 +92,0 @@ }

@@ -143,3 +143,3 @@ /*

loadImage.hasCanvasOption = function (options) {
return options.canvas || options.crop || options.aspectRatio
return options.canvas || options.crop || !!options.aspectRatio
}

@@ -169,2 +169,4 @@

var sourceY
var pixelRatio
var downsamplingRatio
var tmp

@@ -177,4 +179,4 @@ function scaleUp () {

if (scale > 1) {
destWidth = destWidth * scale
destHeight = destHeight * scale
destWidth *= scale
destHeight *= scale
}

@@ -188,4 +190,4 @@ }

if (scale < 1) {
destWidth = destWidth * scale
destHeight = destHeight * scale
destWidth *= scale
destHeight *= scale
}

@@ -249,2 +251,47 @@ }

if (useCanvas) {
pixelRatio = options.pixelRatio
if (pixelRatio > 1) {
canvas.style.width = destWidth + 'px'
canvas.style.height = destHeight + 'px'
destWidth *= pixelRatio
destHeight *= pixelRatio
canvas.getContext('2d').scale(pixelRatio, pixelRatio)
}
downsamplingRatio = options.downsamplingRatio
if (downsamplingRatio > 0 && downsamplingRatio < 1 &&
destWidth < sourceWidth && destHeight < sourceHeight) {
while (sourceWidth * downsamplingRatio > destWidth) {
canvas.width = sourceWidth * downsamplingRatio
canvas.height = sourceHeight * downsamplingRatio
loadImage.renderImageToCanvas(
canvas,
img,
sourceX,
sourceY,
sourceWidth,
sourceHeight,
0,
0,
canvas.width,
canvas.height
)
sourceWidth = canvas.width
sourceHeight = canvas.height
img = document.createElement('canvas')
img.width = sourceWidth
img.height = sourceHeight
loadImage.renderImageToCanvas(
img,
canvas,
0,
0,
sourceWidth,
sourceHeight,
0,
0,
sourceWidth,
sourceHeight
)
}
}
canvas.width = destWidth

@@ -251,0 +298,0 @@ canvas.height = destHeight

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