Below I\'ve created a simple test case that shows that when an img tag\'s src is set to different dataUrls, it leaks memory. It looks like the image data is never unloaded a
Some solutions not mentioned in the other answers:
Similar to jpgjs mentioned by @PaulMilham, but with additional features and a nicer API (imo).
General purpose image-processing library for NodeJS, with functionality to both read and write jpeg, png, etc. images (as files, or just in memory).
Since my program is in Electron, I ended up using sharp, as jpeg-js mentioned it as a more performant alternative (due to its core being written in native code).