Add final thumbnail assembly.
This commit is contained in:
parent
72d89c0be9
commit
dd3a185f4b
3 changed files with 37 additions and 0 deletions
|
@ -71,9 +71,15 @@ def PwadPath(wad):
|
|||
def BaseThumbPath(wad, mapstr):
|
||||
return Ensure(OUTPUT.joinpath(wad)).joinpath("{}_map{}_base.png".format(wad, mapstr))
|
||||
|
||||
def MDoomPath(wad):
|
||||
return Ensure(OUTPUT.joinpath(wad)).joinpath("M_DOOM_scaled.png")
|
||||
|
||||
def TextThumbPath(wad, mapstr):
|
||||
return Ensure(OUTPUT.joinpath(wad)).joinpath("{}_map{}_text.png".format(wad, mapstr))
|
||||
|
||||
def ThumbPath(wad, mapstr):
|
||||
return Ensure(OUTPUT.joinpath(wad)).joinpath("{}_map{}_thumb.png".format(wad, mapstr))
|
||||
|
||||
def VideoPath(wad, mapstr):
|
||||
return Ensure(OUTPUT.joinpath(wad)).joinpath("{}_map{}.mp4".format(wad, mapstr))
|
||||
|
||||
|
|
30
dcc/thumb.py
Normal file
30
dcc/thumb.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
import dcc.config
|
||||
import dcc.doom_base
|
||||
import wand.color
|
||||
import wand.image
|
||||
|
||||
class Thumb(dcc.doom_base.WadMap):
|
||||
def get_parser(self, prog_name):
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument("--index", action="store_true")
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
base = dcc.config.BaseThumbPath(parsed_args.wad, parsed_args.map)
|
||||
text = dcc.config.TextThumbPath(parsed_args.wad, parsed_args.map)
|
||||
mdoom = dcc.config.MDoomPath(parsed_args.wad)
|
||||
with wand.image.Image(filename=base) as bi, wand.color.Color("transparent") as tc:
|
||||
with wand.image.Image(filename=text) as ti:
|
||||
ti.border(tc, 5, 5)
|
||||
bi.composite(ti, gravity="south_west")
|
||||
|
||||
with wand.image.Image(filename=mdoom) as mdi:
|
||||
mdi.border(tc, 5, 5)
|
||||
bi.composite(mdi, gravity="north_west")
|
||||
|
||||
if parsed_args.index:
|
||||
with wand.image.Image(filename=dcc.config.OUTPUT.joinpath("doomed_index.png")) as di:
|
||||
di.border(tc, 1, 1)
|
||||
bi.composite(di, gravity="north_east")
|
||||
|
||||
bi.save(filename=dcc.config.ThumbPath(parsed_args.wad, parsed_args.map))
|
1
setup.py
1
setup.py
|
@ -31,6 +31,7 @@ setup(
|
|||
'extract = dcc.extract:Extract',
|
||||
'fetch = dcc.fetch:Fetch',
|
||||
'text = dcc.text:Text',
|
||||
'thumb = dcc.thumb:Thumb',
|
||||
],
|
||||
},
|
||||
zip_safe=False,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue