Package: get-stick-bugged-lol
get-stick-bugged-lolA Python module and command-line tool that generates aGet Stick Bugged Lolvideo from any image.Examplegsbl python.jpg python.mp4 -r 760 475 -s 0.7Example video with soundThis script usespylsd-novato 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.RequirementsPython 3.6 or later (any OS)InstallationThis package can be installed using pip:pip install get-stick-bugged-lolUsageIn the terminalInstalling the package will register thegsblcommand in the terminal (or you can usepython -m gsbl). To use the
imageinput.pngto generate the videooutput.mp4:gsbl input.png output.mp4Optional arguments:-h, --helpshow this help message and exit-r --resolution WIDTH HEIGHTwidth and height of the video (default: 720 720)--img-bg-color R G BRGB background color while the image is visible (default: 0 0 0)--line-color R G BRGB color of line segments (default: 255 255 211)--line-bg-color R G BRGB background color after image disappears (default: 125 115 119)-s --scale SCALEthe 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 scriptfromPILimportImagefromgsbl.stick_bugimportStickBug# Create the StickBug objectsb=StickBug(Image.open('example.png'))# parameter can also just be a filepath# Change some properties if you wantsb.video_resolution=(1280,720)sb.lsd_scale=0.5# That's it! The video will be generated the first time you access itvideo=sb.video# MoviePy VideoClip# Or you can just save itsb.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.videoStickBugpropertiesimagethe source PIL Image. You can set this when initializingStickBug, or at any time by accessing the property.
If you want, you can leave this parameter empty while initializing.segmentsa 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_resolutionthe resolution of the video as a tuplelsd_scalethe 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_colorthe background color of the video while the image is visibleline_colorthe color of the line segments in the videoline_bg_colorthe background color of the video after the image disappearsBuildingInstall the required packages:pip install -r requirements.txtInstall this package directly:cd [path to repository]
pip install .Or build a wheel:cd [path to repository]
python3 setup.py bdist_wheelLicenseThis package is available under the MIT License. SeeLICENSEfor more info.This package makes use of the following external libraries:pylsd-novaNumPyPillowMoviePy