mesh-gradient.js
mesh-gradient.js copied to clipboard
Generate as a Image
Hi, I would like to now if there is a way to generate this mesh gradient as a png file
Hi, @pedriin1 Currently no, but it is easy to integrate. Feel free to create PR.
Snippet from my other project - https://github.com/anup-a/meshy/blob/main/src/lib/utils/downloadImage.js
import { saveAs } from "file-saver";
const downloadImage = (filename) => {
const canvas = document.getElementById("gradient-canvas");
canvas.toBlob(function (blob) {
saveAs(blob, filename + ".png");
});
};
export default downloadImage;
Oh nice, is there a way to create a lambda to return a mesh gradient as an image passing colors as parameter??
If I understand correctly you want to create a hosted API which generates a png image.
Should be very straightforward with this library. Let me know if you face any problems.
Yes, I want to create a lambda in aws that generates a png images. I can`t do it because mesh is based on html, it must be event driven. To generate a canvas inside javascript its a little bit difficult. Its there a function that export mesh as png?
Currently, it doesn't support server-side rendering. I can definitely give it a shot with node-canvas but I'm not too sure about how well it works.