How to use the jimp.FONT_SANS_16_BLACK function in jimp

To help you get started, we’ve selected a few jimp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Mitorisia / Komugari / commands / memes / bonzi.js View on Github external
exports.run = async (client, message, Discord, args) => {
	if (!message.channel.permissionsFor(client.user.id).has('ATTACH_FILES')) {
		return message.reply('I can\'t attach messages!').then(m => m.delete(5000));
	}

	if (args.length < 1) {
		return message.channel.send('Please provide arguments.')
	}

	const text = message.content.split(/\s+/g).slice(1).join(" ");
    const bonzi = await Jimp.read('./assets/images/bonzi.png')
    const blank = await Jimp.read('./assets/images/blank.png')

	const font = await Jimp.loadFont(Jimp.FONT_SANS_16_BLACK)

	blank.resize(175, 120)
	const fact = blank.print(font, 0, 0, text, 175)

	try{
	bonzi.composite(fact, 23, 12)
	bonzi.getBuffer(Jimp.MIME_PNG, async (err, buffer) => {
			await message.channel.send({
				files: [{
					name: 'bonzi.png',
					attachment: buffer
				}]
			})
	})
	} catch(err) {
		return message.channel.send(`Something went wrong while executing that function.`).then(m => m.delete(5000));
github Mitorisia / Komugari / commands / memes / bonzi.js View on Github external
async run(message, args) {
        var argu = args.argument
        if (argu = 'N////A') {
            return message.channel.send('Please provide something for Bonzi to say!');
        }

        await message.channel.startTyping()

        var text = message.content.split(/\s+/g).slice(1).join(" ");
        var bonzi = await Jimp.read('assets/images/bonzi.png');
        var blank = await Jimp.read('assets/images/blank.png');

        var font = await Jimp.loadFont(Jimp.FONT_SANS_16_BLACK);

        blank.resize(175, 120);
        var fact = blank.print(font, 0, 0, text, 175);

        bonzi.composite(fact, 23, 12);
        bonzi.getBuffer(Jimp.MIME_PNG, async(err, buffer) => {
            await message.channel.send({
                files: [{
                    name: 'bonzi.png',
                    attachment: buffer
                }]
            })
            await message.channel.stopTyping()
        })

        return null;
github Mitorisia / Komugari / commands / memes / retarded.js View on Github external
async run(message) {
        if (!message.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) {
            return message.channel.send('I can\'t attach messages!')
        }

        const argu = message.content.split(/\s+/g).slice(1).join(" ");

        if (!argu) {
            return message.channel.send('Please provide some text!');
        }

        const text = message.content.split(/\s+/g).slice(1).join(" ");
        const retarded = await Jimp.read('assets/images/retarded.png');
        const blank = await Jimp.read('assets/images/blank.png');

        const font = await Jimp.loadFont(Jimp.FONT_SANS_16_BLACK);

        blank.resize(225, 45);
        const search = blank.print(font, 0, 0, text, 225);

        retarded.composite(search, 295, 5);
        retarded.getBuffer(Jimp.MIME_PNG, async(err, buffer) => {
            return await message.channel.send({
                files: [{
                    name: 'retarded.png',
                    attachment: buffer
                }]
            })
        })
    }
}
github Mitorisia / Komugari / commands / memes / retarded.js View on Github external
async run (message) {
        if (!message.channel.permissionsFor(this.client.user.id).has('ATTACH_FILES')) {
			return message.channel.send('I can\'t attach messages!')
		}

		const argu = message.content.split(/\s+/g).slice(1).join(" ");
		
		if (!argu) {
			return message.channel.send('Please provide some text!');
		}
	
		const text = message.content.split(/\s+/g).slice(1).join(" ");
		const retarded = await Jimp.read('assets/images/retarded.png');
		const blank = await Jimp.read('assets/images/blank.png');
	
		const font = await Jimp.loadFont(Jimp.FONT_SANS_16_BLACK);
		
		blank.resize(225, 45);
		const search = blank.print(font, 0, 0, text, 225);
	
		retarded.composite(search, 295, 5);
		retarded.getBuffer(Jimp.MIME_PNG, async (err, buffer) => {
			try {
				return await message.channel.send({
					files: [{
						name: 'retarded.png',
						attachment: buffer
					}]
				})
				
			} catch (err) {
				return message.channel.send(`✖ Something went wrong while executing that function!`);
github Mitorisia / Komugari / commands / memes / thesearch.js View on Github external
return message.channel.send('I can\'t attach messages!');
        }

        const args = message.content.split(/\s+/g).slice(1).join(" ");

        if (args.length < 1) {
            return message.channel.send('Please provide some text!');
        }

        await message.channel.startTyping()

        const text = message.content.split(/\s+/g).slice(1).join(" ");
        const thesearch = await Jimp.read('assets/images/thesearch.png');
        const blank = await Jimp.read('assets/images/blank.png');

        const font = await Jimp.loadFont(Jimp.FONT_SANS_16_BLACK);

        blank.resize(160, 70);
        const search = blank.print(font, 0, 0, text, 150);

        thesearch.composite(search, 60, 331);
        thesearch.getBuffer(Jimp.MIME_PNG, async(err, buffer) => {
            await message.channel.send({
                files: [{
                    name: 'thesearch.png',
                    attachment: buffer
                }]
            })
            await message.channel.stopTyping()
        })

        return null;
github Mitorisia / Komugari / commands / memes / thesearch.js View on Github external
async run (message) {
        if (!message.channel.permissionsFor(this.client.user.id).has('ATTACH_FILES')) {
			return message.channel.send('I can\'t attach messages!');
		}
	
		const args = message.content.split(/\s+/g).slice(1).join(" ");
		
		if (args.length < 1) {
			return message.channel.send('Please provide some text!');
		}
	
		const text = message.content.split(/\s+/g).slice(1).join(" ");
		const thesearch = await Jimp.read('assets/images/thesearch.png');
		const blank = await Jimp.read('assets/images/blank.png');
	
		const font = await Jimp.loadFont(Jimp.FONT_SANS_16_BLACK);
	
		blank.resize(160, 70);
		const search = blank.print(font, 0, 0, text, 150);
	
		thesearch.composite(search, 60, 331);
		thesearch.getBuffer(Jimp.MIME_PNG, async (err, buffer) => {
			try {
				return await message.channel.send({
					files: [{
						name: 'thesearch.png',
						attachment: buffer
					}]
				})
	
			} catch (err) {
				return message.channel.send(`✖ Something went wrong while executing that function.`);
github NGRP / node-red-contrib-viseo / node-red-contrib-jimp / node-jimp.js View on Github external
w = (old_w > old_h) ? Jimp.AUTO : 400;
            h = (old_w < old_h) ? Jimp.AUTO : 400;

            try { image.resize(w, h); }
            catch (err) {
                node.error(err);
                return node.send([null, data])
            }

            w = image.bitmap.width;
            h = image.bitmap.height;
        }

        try {
            font_white = await Jimp.loadFont(Jimp.FONT_SANS_16_WHITE);
            font_black = await Jimp.loadFont(Jimp.FONT_SANS_16_BLACK);
        }
        catch (err) {
            node.error(err);
            return node.send([null, data])
        }

        for (let face of drawRect) {
            if (!face.top || !face.left || !face.width || !face.height) {
                throw TypeError("Some of the Rectangle object properties are missing, eg: top, left, width and/or height.");
            }
            if (drawLogo) {
                face.top = Math.round(face.top * (h/old_h));
                face.left = Math.round(face.left * (w/old_w));
                face.width = Math.round(face.width * (w/old_w));
                face.height = Math.round(face.height* (h/old_h));
            }
github Mitorisia / Komugari / commands / memes / byemom.js View on Github external
if (args.length > 47) {
		return message.channel.send(`Google Search too long. You're ${args.length - 47} characters over the limit!`)
	}

	const avatar = await Jimp.read(avatarurl)
	const avatar2 = avatar.clone()
	const text = args
	const mom = await Jimp.read('./assets/images/mom.png')
	const blank = await Jimp.read('./assets/images/blank.png')

	avatar.resize(70, 70)
	avatar2.resize(125, 125)
	mom.composite(avatar, 530, 15)
	mom.composite(avatar2, 70, 340)

	const font = await Jimp.loadFont(Jimp.FONT_SANS_16_BLACK)

	blank.resize(275, 200)
	const search = blank.print(font, 0, 0, text)
	search.rotate(335)

	mom.composite(search, 375, 465)
	mom.getBuffer(Jimp.MIME_PNG, async (err, buffer) => {
		try {
			await message.channel.send({
				files: [{
					name: 'mom.png',
					attachment: buffer
				}]
			})
		} catch (err) {
			return message.channel.send(`Something went wrong while executing that function.`).then(m => m.delete(5000));
github azavea / tilegarden / src / tiler / src / util / message-tile.js View on Github external
    .then(tile => Jimp.loadFont(Jimp.FONT_SANS_16_BLACK)
        .then((font) => {
            tile.print(font, 10, 10, message, 246)
            return tile
        }))
    .then(toBuffer)