Last active
May 22, 2020 01:22
-
-
Save irubnich/f931c03069d709d5704868b7503a9b02 to your computer and use it in GitHub Desktop.
dumb meme test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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