Skip to main content

'Get stick bugged' video generator

Project description

get-stick-bugged-lmao

A Python module and command-line tool that generates a Get Stick Bugged Lol video from any image.

Example

gsblmao python.jpg python.mp4 -r 760 475 -s 0.7

Example GIF

Example video with sound

This script uses pylsd-nova to detect line segments in the image, Pillow to draw the lines as they move to form the stick bug, and MoviePy to create the video.

Requirements

  • Python 3.6 or later (any OS)

Installation

This package can be installed using pip:

pip install get-stick-bugged-lmao

Usage

In the terminal

Installing the package will register the gsblmao command in the terminal (or you can use python -m gsblmao). To use the image input.png to generate the video output.mp4:

gsblmao input.png output.mp4

Optional arguments:

  • -h, --help show this help message and exit
  • -r --resolution WIDTH HEIGHT width and height of the video (default: 720 720)
  • --img-bg-color R G B RGB background color while the image is visible (default: 0 0 0)
  • --line-color R G B RGB color of line segments (default: 255 255 211)
  • --line-bg-color R G B RGB background color after image disappears (default: 125 115 119)
  • -s --scale SCALE the image scale passed to the line segment detector. Slightly lowering this may improve results in large images. This does not affect the image scale in the video (try --resolution instead). (default: 0.8)

In a Python script

from PIL import Image
from gsblmao.stick_bug import StickBug

# Create the StickBug object
sb = StickBug(Image.open('example.png'))  # parameter can also just be a filepath

# Change some properties if you want
sb.video_resolution = (1280, 720)
sb.lsd_scale = 0.5

# That's it! The video will be generated the first time you access it
video = sb.video  # MoviePy VideoClip

# Or you can just save it
sb.save_video('example.mp4')

# If any settings were changed, the video will be regenerated the next time you access it.
sb.line_color = (128, 0, 255)
video_purple = sb.video

StickBug properties

  • image the source PIL Image. You can set this when initializing StickBug, or at any time by accessing the property. If you want, you can leave this parameter empty while initializing.

  • segments a numpy array of the 9 line segments detected. If the line segment detector hasn't run yet, that's done the first time this is accessed. The line segment detector will run again if any other properties have changed. This can also be set manually if you want. Each row of the array must contain the values [x1, y1, x2, y2, width].

  • video (readonly) the MoviePy VideoClip generated by the script. If the video hasn't been generated yet, that's done the first time this is accessed. The video will be regenerated if any other properties have changed.

  • video_resolution the resolution of the video as a tuple

  • lsd_scale the image scale passed to the line segment detector. Slightly lowering this may improve results in large images. This does not affect the image scale in the video.

  • img_bg_color the background color of the video while the image is visible

  • line_color the color of the line segments in the video

  • line_bg_color the background color of the video after the image disappears

Building

Install the required packages:

pip install -r requirements.txt

Install this package directly:

cd [path to repository]
pip install .

Or build a wheel:

cd [path to repository]
python3 setup.py bdist_wheel

License

This package is available under the MIT License. See LICENSE for more info.

This package makes use of the following external libraries:

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

get-stick-bugged-lmao-1.0.2.tar.gz (2.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

get_stick_bugged_lmao-1.0.2-py3-none-any.whl (2.6 MB view details)

Uploaded Python 3

File details

Details for the file get-stick-bugged-lmao-1.0.2.tar.gz.

File metadata

  • Download URL: get-stick-bugged-lmao-1.0.2.tar.gz
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for get-stick-bugged-lmao-1.0.2.tar.gz
Algorithm Hash digest
SHA256 ef2bc4ba610f638ec79ce9b5aaa56018bcaeb7d44e0b7ab78dd71e4c345f2ffd
MD5 ddb428d36376a550afbb52d5808d9933
BLAKE2b-256 0063629d166db09387f5ea9a1e841bee7eb70347e878c8e5cc3666adff07ee13

See more details on using hashes here.

File details

Details for the file get_stick_bugged_lmao-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for get_stick_bugged_lmao-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 89d7392c086a6e73c3b82d5b3414ee6ea8beb6d7ab9de5360b73f982298f7990
MD5 419ea16b83bc852147d867173a2a2ec8
BLAKE2b-256 492d8e3ee9a79c864515d5d6fb01652d1d2a9a1cb1a8287c58dc4b24d8d2faa5

See more details on using hashes here.

Supported by

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