Skip to main content

Utility for a generation of memes

Project description

White Generator

Utility for a generation of memes.

Features

  • a generation of memes (in PNG format);
  • a support of plain and graphic backgrounds;
  • a specification of a text rectangle;
  • a support of horizontal and vertical text alignments;
  • a read of memes texts from a file (each text is separated from another by a double newline);
  • a support single-line and multiline memes texts;
  • a protection against duplicate memes texts (it's optional);
  • a support of a watermark (it's optional);
  • meme settings:
    • background:
      • color;
      • width;
      • height;
      • image:
        • it supports the same formats as Pillow library;
        • it'll be resized to the specified size (it's optional);
      • resizing filter;
    • text:
      • font:
        • it supports only TrueType fonts;
        • it's optional (if none, the Pillow library's default font is used);
      • size;
      • color;
      • rectangle:
        • left;
        • rigth (if the value is negative, the image width is added to it);
        • top;
        • bottom (if the value is negative, the image height is added to it);
      • horizontal alignment;
      • vertical alignment;
    • watermark:
      • font (it always uses the text font);
      • text;
      • size;
      • color.

Installation

$ pip install white-generator

Usage

$ white-generator -v | --version
$ white-generator -h | --help
$ white-generator [options] (-i INPUT_FILE | --input-file INPUT_FILE)

Options:

  • -v, --version — show the version message and exit;
  • -h, --help — show this help message and exit;
  • -i INPUT_FILE, --input-file INPUT_FILE — the path to the file with notes;
  • -o OUTPUT_PATH, --output-path OUTPUT_PATH — the path for generated images (default: output);
  • -l TEXT_RECTANGLE_LEFT, --text-rectangle-left TEXT_RECTANGLE_LEFT — the left text position (default: 0);
  • -t TEXT_RECTANGLE_TOP, --text-rectangle-top TEXT_RECTANGLE_TOP — the top text position (default: 0);
  • -R TEXT_RECTANGLE_RIGHT, --text-rectangle-right TEXT_RECTANGLE_RIGHT — the horizontal text limit (if the value is negative, the image width is added to it; default: -1);
  • -B TEXT_RECTANGLE_BOTTOM, --text-rectangle-bottom TEXT_RECTANGLE_BOTTOM — the vertical text limit (if the value is negative, the image height is added to it; default: -1);
  • -a {left,center,right}, --text-horizontal-align {left,center,right} — the text horizontal alignment (default: center);
  • -A {top,center,bottom}, --text-vertical-align {top,center,bottom} — the text vertical alignment (default: center);
  • -W IMAGE_WIDTH, --image-width IMAGE_WIDTH — the image width (default: 640);
  • -H IMAGE_HEIGHT, --image-height IMAGE_HEIGHT — the image height (default: 480);
  • -b IMAGE_BACKGROUND_COLOR, --image-background-color IMAGE_BACKGROUND_COLOR — the image background color (default: rgb(255, 255, 255));
  • -I IMAGE_BACKGROUND_IMAGE, --image-background-image IMAGE_BACKGROUND_IMAGE — the path to the background image (default: none);
  • -F {nearest,box,bilinear,hamming,bicubic,lanczos}, --image-resizing-filter {nearest,box,bilinear,hamming,bicubic,lanczos} — the resizing filter for the background image (default: lanczos);
  • -f TEXT_FONT_FILE, --text-font-file TEXT_FONT_FILE — the path to the font file (if none, the Pillow library's default font is used; default: none);
  • -s TEXT_FONT_SIZE, --text-font-size TEXT_FONT_SIZE — the font size (default: 25);
  • -c TEXT_FONT_COLOR, --text-font-color TEXT_FONT_COLOR — the font color (default: rgb(0, 0, 0));
  • -w WATERMARK_TEXT, --watermark-text WATERMARK_TEXT — the watermark text (default: none);
  • -S WATERMARK_SIZE, --watermark-size WATERMARK_SIZE — the watermark font size (default: 12);
  • -C WATERMARK_COLOR, --watermark-color WATERMARK_COLOR — the watermark font color (default: rgb(128, 128, 128));
  • --no-database — don't filter notes by database;
  • --no-resizing — don't resize the background image.

Generated Images

License

The MIT License (MIT)

Copyright © 2017, 2024 thewizardplusplus

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

white-generator-2.0.0.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

white_generator-2.0.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file white-generator-2.0.0.tar.gz.

File metadata

  • Download URL: white-generator-2.0.0.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for white-generator-2.0.0.tar.gz
Algorithm Hash digest
SHA256 6b8f771d65ad32174f562ffb11c96e50220cf7adf0a1aa55d585c8c6eabc3b76
MD5 114ce0a986969c94f185d28e8b67fb4c
BLAKE2b-256 530d510b5ae1954cd6fa9372390dac853071d18d20a5cc337f92d9b7c055a112

See more details on using hashes here.

File details

Details for the file white_generator-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for white_generator-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51866e4b7203e475efcda4ad846f2e4b0ba218e8ee54744bb61c361cd337089c
MD5 deea5c9ec3ff536d376d8d7ce61554fd
BLAKE2b-256 c0479ac827095df3c76a077594d1e9ad58e85a4039996b36179a2fb4418d4633

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page