question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

toBlob is not a function

See original GitHub issue

I tried to use pica but Exif was a big pain. Thank you for this package 😃

When I try to use it using the code below

            let fr = new FileReader();
            const reduce = require('image-blob-reduce')();
            reduce.toBlob(fr.readAsBinaryString(file), {
                max: 300,
                unsharpAmount: 90,
                unsharpRadius: 0.6,
                unsharpThreshold: 2 })
                .then(blob => {
                    addThumbnail(blob)
                });

I got error Uncaught (in promise) TypeError: reduce.toBlob is not a function

I could not get it worked. Is it me or something is wrong?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
puzrincommented, Jul 11, 2020

Added pica options support and updated demo appropriately.

Is issue solved?

1reaction
puzrincommented, Jul 10, 2020

Did you browserified it (or use /dist instead)? Try demo src and npm run demo as playground. Also first param of toBlob() should be Blob or File, you should not try to .read* it into something else. Just pass form field value as is. See how demo arrange this.

Pica options (unsharp* and others) are no supported now https://github.com/nodeca/image-blob-reduce/blob/master/index.js#L120. We just started to search optimal api, because it’s a bit different for blobs. Now users are expected to override default methods or inject aditional actions. But you are right, probably we need something more simple for unsharp.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Canvas toBlob is not recognized as a function in Chrome or IE
and it works fine to return the data but toBlob doesn't seem to work. Here is my JS and HTML. var canvas =...
Read more >
Error: TypeError: data.image.toBlob is not a function · Issue #114
When I upload a file image, i get this error Error: TypeError: data.image.toBlob is not a function $('.wrapper').on('change', ...
Read more >
HTMLCanvasElement.toBlob() - Web APIs | MDN
The HTMLCanvasElement.toBlob() method creates a Blob object representing the image contained in the canvas. This file may be cached on the ...
Read more >
toBlob JavaScript and Node.js code examples - Tabnine
toBlob. function. Best JavaScript code snippets using toBlob(Showing top 15 results out of 315).
Read more >
Canvas toBlob - JSFiddle - Code Playground
Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found