Skip to content

Commit 41268d8

Browse files
authored
Merge pull request #3 from n0spaces/rewrite
Rewrite
2 parents 59aa004 + d2b17a8 commit 41268d8

File tree

18 files changed

+361
-184
lines changed

18 files changed

+361
-184
lines changed

gsbl/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
from .generator import generate_video_from_image_path as generate_stick_bug
2-
from .generator import save_video

gsbl/__main__.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
11
def main():
22
import argparse
3-
import gsbl
43

54
parser = argparse.ArgumentParser(prog='gsbl', description="Create a 'get stick bugged lol' video from an image.")
6-
parser.add_argument('input', help='the image file to be used to generate the video (png, jpg, ...)')
5+
parser.add_argument('input',
6+
help="the image file to be used to generate the video (png, jpg, ...). For best results, make"
7+
"sure the image doesn't have any black or white borders surrounding it.")
78
parser.add_argument('output', help='the video file to be generated and saved (mp4, webm, ...)')
9+
parser.add_argument('-r --resolution', dest='resolution', nargs=2, type=int, default=[720, 720],
10+
metavar=('WIDTH', 'HEIGHT'), help='width and height of the video (default: 720 720)')
11+
parser.add_argument('--img-bg-color', dest='img_bg_color', nargs=3, type=int, default=[0, 0, 0],
12+
metavar=('R', 'G', 'B'),
13+
help='RGB background color while the image is visible (default: 0 0 0)')
814
parser.add_argument('--line-color', dest='line_color', nargs=3, type=int, default=[255, 255, 211],
9-
metavar=('R', 'G', 'B'), help='RGB color to use for line segments (default: 255 255 211)')
10-
parser.add_argument('--bg-color', dest='bg_color', nargs=3, type=int, default=[125, 115, 119],
15+
metavar=('R', 'G', 'B'), help='RGB color of line segments (default: 255 255 211)')
16+
parser.add_argument('--line-bg-color', dest='line_bg_color', nargs=3, type=int, default=[125, 115, 119],
1117
metavar=('R', 'G', 'B'),
12-
help='RGB color to use for background after image disappears (default: 125 115 119)')
18+
help='RGB background color after image disappears (default: 125 115 119)')
19+
parser.add_argument('-s --scale', dest='lsd_scale', type=float, default=0.8, metavar='SCALE',
20+
help='the image scale passed to the line segment detector. Slightly lowering this may improve'
21+
'results in large images. This does not affect the image scale in the video (try '
22+
'--resolution instead). (default: 0.8)')
1323

1424
args = parser.parse_args()
1525

16-
video = gsbl.generate_stick_bug(args.input, tuple(args.line_color), tuple(args.bg_color))
17-
gsbl.save_video(video, args.output)
26+
try:
27+
from gsbl.stick_bug import StickBug
28+
except ImportError:
29+
# if running this file directly while the package isn't installed
30+
# noinspection PyUnresolvedReferences
31+
from stick_bug import StickBug
32+
33+
sb = StickBug(img=args.input, video_resolution=args.resolution, lsd_scale=args.lsd_scale,
34+
img_bg_color=args.img_bg_color, line_color=args.line_color, line_bg_color=args.line_bg_color)
35+
sb.save_video(args.output)
1836

1937

2038
if __name__ == '__main__':

gsbl/generator.py

Lines changed: 0 additions & 174 deletions
This file was deleted.

gsbl/media/audio.wav

-2.62 MB
Binary file not shown.

gsbl/media/note0.wav

57.5 KB
Binary file not shown.

gsbl/media/note1.wav

57.3 KB
Binary file not shown.

gsbl/media/note2.wav

57.8 KB
Binary file not shown.

gsbl/media/note3.wav

57.3 KB
Binary file not shown.

gsbl/media/note4.wav

57.5 KB
Binary file not shown.

gsbl/media/note5.wav

57.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)