Coder Social home page Coder Social logo

vishaljangid1729 / meme Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arguablykomodo/meme

0.0 0.0 0.0 19 KB

Golang program for making memes from the command line. Possibly the worst thing i have made.

License: Creative Commons Zero v1.0 Universal

Go 100.00%

meme's Introduction

The meme-making CLI you never asked for!

Finally a command line interface for automating shitty meme templates

Licensed under CC0 1.0 Universal, so that anyone everywhere can use and abuse this monster that i have created

Why did you make this?

I did this due to a combination of several different things

  1. Boredom
  2. Free time
  3. Wanting to learn Go
  4. Crippling depression Love

How do you use this?

Glossary

Name Meaning
meme The program
Meme A .toml file that represents a meme
Template A .toml file that represents a meme template

CLI

meme has the following commands

  • meme [file, file2, ...fileN]
    • [file] would be a Meme that you want to render into an image
    • For example meme thing.toml would render the Meme in thing.toml into an image at thing.png
    • And meme thing.toml otherThing.toml would render both Memes
  • meme [dir, dir2, ...dirN]
    • [dir] would be a directory containing several Meme files: These files will be all rendered into an image
    • For example meme . would render all Memes in the current directory
    • And meme folder otherFolder would render all Memes in both folders

Schema

Template

A Template is a TOML encoded file, it must contain these properties:

Name Meaning
Image A path to an image file, this will be the base template of the Meme
HAlign The horizontal alignment for the text in the Meme can be 1 for left aligned, 2 for center align, and 3 for right align
VAlign Same as HAlign, but for vertical alignment
Font A path to a font file, this will be the font that the text in the Meme will use
FontSize Pretty self-explanatory
Color Defines the color that the text will use via RGB values from 0 to 1. For example [1.0, 1.0, 1.0] for white
Rotation Defines the rotation of the text in degrees

Besides all of these properties, a Template has the Fields property, which is an array of structs that have the following properties:

Name Meaning
Name An identifier for the field, this will be used in the Meme file for putting text or an image in it, multiple fields can have the same name
X The X position of the field
Y The Y position of the field
W The width of the field
H The height of the field

You can also use the same HAlign/VAlign/Font/FontSize/Color options from the Template in each field, and those settings will be applied individually to that field

For example, this is a simple template file for the good old Drake meme

Image="drake.png"
Font="C:/Windows/Fonts/arial.ttf"
FontSize=50.0
Color=[0.0, 0.0, 0.0]
HAlign=2
VAlign=2

[[Fields]]
Name="Bad"
X=674.0
Y=0.0
W=670.0
H=670.0

[[Fields]]
Name="Good"
X=674.0
Y=674.0
W=670.0
H=670.0

Meme

A Meme is also a TOML encoded file, and it is the one that "implements" the Template that you defined earlier.

It has a Template property, which is a path to the Template that you want to implement

The other property is the Fields property, for each field in the Template, you have a property in Fields with that field's name in the Meme. For example, if your Template has a field named "Foo" and you want it to have the text "Bar", you would add Foo="text:Bar" to your Meme.

As you probably noticed, the text has the text: prefix, this let's the program know you are writing text. If you wanted to, for example, put an image called bar.png into that field, you would write Foo="url:bar.png"

This is getting a little complicated, so let's see an example of a Meme file for the Drake template we saw earlier:

Template="Templates/drake.toml"

[Fields]
  Bad="text:Making a meme normally"
  Good="text:Creating a way too complicated program for making them automatically"

meme's People

Contributors

arguablykomodo avatar

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.