WangYuLue / image-conversion

A simple and easy-to-use JS image convert tools, which can specify size to compress the image.
https://demo.wangyulue.com/image-conversion/
MIT License
909 stars 140 forks source link

Blob is not defined #18

Closed scaki closed 4 years ago

scaki commented 4 years ago

It gives "UnhandledPromiseRejectionWarning: ReferenceError: Blob is not defined" error.

imageConversion.compressAccurately(data, { size: 100, //The compressed image size is 100kb accuracy: 0.9, //the accuracy of image compression size,range 0.8-0.99,default 0.95; //this means if the picture size is set to 1000Kb and the //accuracy is 0.9, the image with the compression result //of 900Kb-1100Kb is considered acceptable; type: 'image/jpeg', width: 300, height: 200, orientation: 2, scale: 0.5 });

WangYuLue commented 4 years ago

What is your browser and os version

Kiwinka commented 4 years ago

Hi,

I have similar error: ReferenceError: Blob is not defined

ReferenceError: Blob is not defined [1] at Module. (/home/kiw/Programming/BP_code/app/node_modules/image-conversion/build/conversion.js:1:6142) [1] at Generator.next () [1] at /home/kiw/Programming/BP_code/app/node_modules/image-conversion/build/conversion.js:1:5551 [1] at new Promise () [1] at y (/home/kiw/Programming/BP_code/app/node_modules/image-conversion/build/conversion.js:1:5296) [1] at Module.b (/home/kiw/Programming/BP_code/app/node_modules/image-conversion/build/conversion.js:1:6090) [1] at createMiniature (/home/kiw/Programming/BP_code/app/app/electron/communication.js:71:38) [1] at /home/kiw/Programming/BP_code/app/app/electron/communication.js:249:41 [1] at tryCatcher (/home/kiw/Programming/BP_code/app/node_modules/bluebird/js/release/util.js:16:23)

I use it like this:

const result = imageConversion.compressAccurately(pathToPhoto, 150).then((res) => { console.log(res) }).catch((e) => { console.log(e) });

What am I doing wrong? I run it in Electron

bsor-dev commented 3 years ago

Same