diff --git a/dcc/config.py b/dcc/config.py index 85267db..9aaae33 100644 --- a/dcc/config.py +++ b/dcc/config.py @@ -14,6 +14,9 @@ OUTPUT=DOOM.joinpath("fabricate") DEFAULT_IWAD=IWADS.joinpath("DOOM2.WAD") +THUMB_WIDTH=1280 +THUMB_HEIGHT=720 + def DsdaPreamble(wad, mapstr): args = [] pwadpath = PWADS.joinpath(wad) @@ -54,8 +57,11 @@ def DemoInPath(wad, mapstr): def DemoOutPath(wad, mapstr): return DEMOS.joinpath(wad).joinpath(DemoName(wad, mapstr)) -def VideoPath(wad, mapstr): - return OUTPUT.joinpath(wad).joinpath("{}_map{}.mp4".format(wad, mapstr)) - def DemoName(wad, mapstr): return "{}_map{}.lmp".format(wad, mapstr) + +def BaseThumbPath(wad, mapstr): + return OUTPUT.joinpath(wad).joinpath("{}_map{}_base.png".format(wad, mapstr)) + +def VideoPath(wad, mapstr): + return OUTPUT.joinpath(wad).joinpath("{}_map{}.mp4".format(wad, mapstr)) diff --git a/dcc/ss.py b/dcc/ss.py new file mode 100644 index 0000000..a119d8b --- /dev/null +++ b/dcc/ss.py @@ -0,0 +1,16 @@ +import dcc.config +import dcc.doom_base +import wand.image + +class SS(dcc.doom_base.WadMap): + def get_parser(self, prog_name): + parser = super().get_parser(prog_name) + parser.add_argument("-g", "--gravity", default="center") + return parser + + def take_action(self, parsed_args): + with wand.image.Image(width=THUMB_WIDTH, height=THUMB_HEIGHT, pseudo="x:") as img: + img.reset_coords() + img.crop(width=THUMB_WIDTH,height=THUMB_HEIGHT,gravity="center") + img.reset_coords() + img.save(filename=dcc.config.BaseThumbPath(parsed_args.wad, parsed_args.map)) diff --git a/setup.py b/setup.py index 34342cf..e6dca03 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,7 @@ setup( 'fabricate = dcc.fabricate:Fabricate', 'put = dcc.put:Put', 'pb = dcc.pb:PB', + 'ss = dcc.ss:SS', ], }, zip_safe=False,