Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading base64 image from a Buffer is slow #1294

Open
Dylan190774 opened this issue May 31, 2024 · 0 comments
Open

Reading base64 image from a Buffer is slow #1294

Dylan190774 opened this issue May 31, 2024 · 0 comments

Comments

@Dylan190774
Copy link

Dylan190774 commented May 31, 2024

In a browser app I'm reading a base64-string from a buffer. The original image is 3072 x 512 pixels.
This takes quite a while to be read (around 500 ms). Is this normal behaviour?

The image is made of 6 webp images of 512x512 each, which I merge with the merge-images package, since Jimp doesn't support reading webp. The reading of the 6 separate image files, merging them and outputting this to a base64-string with merge-images takes only about 250 ms in total.

Here's my code:

    const base64 = '<...  the base64 string of 6 merged webp images...>';
    const url = base64.replace(/^data:image\/\w+;base64,/, '');
    const buffer = Buffer.from(url, 'base64');

    await Jimp.read(buffer)
      .then((img) => {

           //this takes about 500 ms

      }};

My system is not slow at all and it has 16GB of memory.

  • Browser: Chrome: 125.0.6422.77
  • Jimp Version: 0.22.12
  • Operating System: Windows 10
  • Node version: 20.11.1

Any idea's why reading from a base64 string is this slow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant