Closed SteepAtticStairs closed 2 years ago
My initial thought is to let the client do it. I don't know what your end product is but can the web browser, mobile app, OS image viewer, etc do that for you?
If not, I know Jimp can take a buffer directly. Without looking through all the documentation I believe it would be something like:
Jimp.read(level2Plot[1].REF.toBuffer()).resize(4000,4000);
A long time ago I did try SVG. I creates huge files so it wasn't practical for anything that I was doing with it.
Ah - thanks for the response. I tried what you said, and it ended up being
Jimp.read(level2Plot[0].REF.canvas.toBuffer(), (err, img) => {
if (err) throw err;
img
.resize(4000, 4000) // resize
.write('out.png'); // save
});
But what it seemed to do was just make the lower quality image in pixel size, not actually making the radar output quality better.
That would make massive files anyways, so maybe it's not doable.
In the README you say
Do you have a way in mind you could achieve this with any of these libraries? Everything I could find was upscaling raster images, e.g.
jpg
orpng
- not canvas objects.Perhaps exporting the canvas to a vector graphic might be easier, but I assume this would happen in
src/draw/index.js
.