GithubHelp home page GithubHelp logo

xct007 / meme-gen Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 122 KB

Create meme using graphics magick

License: MIT License

JavaScript 31.36% TypeScript 68.64%
graphicsmagick javascript meme-generator meme-maker

meme-gen's Introduction

MEME Gen Maker

Create meme top/bottom text.

Example of meme created with Meme Maker

You need install graphicsmagick in your system before using this package.

Installation

  • use npm
npm install github:xct007/meme-gen
  • use yarn
yarn add github:xct007/meme-gen
  • npm package soon

Usage

  • Basic
    import { memeG } from "meme-gen";
    const meme = new memeG();
    
    // use image
    const input_image = "./danil.jpg";
    meme.image(input_image);
    
    // top text
    meme.top("Anjay");
    
    // bottom text
    meme.bottom("mabar");
    
    // make text upper case
    meme.upper_case();
    
    // create meme and save to disk
    const output = "./result.png";
    meme.writeAsync(output);
    
    // or get a image buffer
    meme.bufferAsync()
  • image options
    import { memeG } from "meme-gen";
    import { readFileSync } from "fs";
    
    const meme = new memeG();
    
    // local path
    meme.image("./danil_strok.jpg");
    
    // using url 
    meme.image("https://example.com/image.jpg");
    
    // buffer
    const image_buffer = readFileSync("./danil.jpg")
    meme.image(image_buffer)
    
    // by default it will use white blank image
    meme.image()
  • text options
    import { memeG } from "meme-gen";
    
    const meme = new memeG();
    
    // fill text color
    meme.fill("#FFF") // white #FFF
    
    // stroke/outline
    meme.stroke("#000") // black #000
    meme.stroke("#000", 2) // stroke width 2
    
    // make text upper case
    meme.uppe_case()
    
    // text padding width
    meme.padding_width(40) // default 40
  • load custom font
    import { memeG } from "meme-gen";
    
    const meme = new memeG();
    
    const font_path = "./myfont.ttf";
    
    meme.load_font(font_path)
  • advance
    import { memeG } from "meme-gen";
    
    const image_buffer = await meme
        .image("https://itsrose.life/rose.jpeg")
        .load_font("./my_font.ttf")
        .fill("#FFF")
        .stroke("#000", 2)
        .padding_width(40)
        .top("OMG")
        .bottom("I love you")
        .upper_case()
        .getBufferAsync()
    
    console.log(image_buffer);

options

  • top: top text input
  • bottom: bottom text input
  • stroke: stroke color and width hex_color: string, stroke_width: number
  • upper_case: text to upper case
  • padding_width: text top/bottom padding
  • load_font: use custom font

Note

This repository project is a learning exercise, and as such it utilizes references from other open source repositories. No commercial use is intended, and all efforts have been made to ensure proper attribution has been given to any referenced libraries and code.

meme-gen's People

Contributors

xct007 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

fxndy17

meme-gen's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.