Reading base64 image from a Buffer is slow
- Dominant language
- TypeScript
- Stars
- 14.7k
- Forks
- 777
- PR merge metrics
- No merged PRs in 30d
Description
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?
Contributor guide
Assessment
This issue has not been assessed yet.