Skip to content

Instantly share code, notes, and snippets.

@irubnich
Last active May 22, 2020 01:22
Show Gist options
  • Save irubnich/f931c03069d709d5704868b7503a9b02 to your computer and use it in GitHub Desktop.
Save irubnich/f931c03069d709d5704868b7503a9b02 to your computer and use it in GitHub Desktop.
dumb meme test
const express = require('express');
const app = express();
const port = 3000;
const Jimp = require('jimp');
const main = async (req, res) => {
const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
const image = await Jimp.read('https://i.imgur.com/anGvElY.jpg');
const printedImage = image.print(font, 10, 10, 'puma');
const response = await printedImage.getBufferAsync(Jimp.MIME_JPEG);
res.set('Content-Type', Jimp.MIME_JPEG);
res.send(response);
};
app.get('/', main);
app.listen(port, () => console.log(`Listening on ${port}...`));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment