Add a screenshot command.
This commit is contained in:
parent
aff20e9557
commit
1094c3aba9
3 changed files with 26 additions and 3 deletions
16
dcc/ss.py
Normal file
16
dcc/ss.py
Normal file
|
@ -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))
|
Loading…
Add table
Add a link
Reference in a new issue