From 454197fc18a781cb65af9a119c05cc3014616c32 Mon Sep 17 00:00:00 2001 From: Sophie Schiller Date: Tue, 17 May 2022 21:46:53 +0200 Subject: [PATCH] gpn20: improve intros --- gpn20/__init__.py | 10 +++--- gpn20/artwork/intro.svg | 67 +++++++++++++++-------------------------- make.py | 4 +++ renderlib.py | 10 +++++- 4 files changed, 42 insertions(+), 49 deletions(-) diff --git a/gpn20/__init__.py b/gpn20/__init__.py index 31dc491..c2629d9 100644 --- a/gpn20/__init__.py +++ b/gpn20/__init__.py @@ -132,15 +132,15 @@ def debug(): '../intro.ts', introFrames, { - '$title': "Long Long Long title is LONG", + '$title': "Long Long Long title is LONG ", '$speaker': 'Long Name of Dr. Dr. Prof. Dr. Long Long' } ) - render('outro.svg', - '../outro.ts', - outroFrames - ) + #render('outro.svg', + # '../outro.ts', + # outroFrames + #) def tasks(queue, args, idlist, skiplist): diff --git a/gpn20/artwork/intro.svg b/gpn20/artwork/intro.svg index 4684160..5842f39 100644 --- a/gpn20/artwork/intro.svg +++ b/gpn20/artwork/intro.svg @@ -16,7 +16,8 @@ version="1.1" id="SVGRoot" inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)" - sodipodi:docname="intro-2.svg"> + sodipodi:docname="intro.svg" + enable-background="new"> + style="opacity:1;"> $title - - - $persons + id="flowPara3673" + style="-inkscape-font-specification:Roboto;font-family:Roboto;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal">$persons $title diff --git a/make.py b/make.py index 0650619..6c0834c 100755 --- a/make.py +++ b/make.py @@ -52,6 +52,10 @@ parser.add_argument('--imagemagick', action="store_true", default=False, help='' Render frames using ImageMagick instead of Inkscape. Usage: ./make.py yourproject/ --imagemagick ''') +parser.add_argument('--resvg', action="store_true", default=False, help=''' + Render frames using resvg instead of Inkscape. + Usage: ./make.py yourproject/ --resvg + ''') if len(sys.argv) < 2: parser.print_help() diff --git a/renderlib.py b/renderlib.py index 3f545a3..a366bce 100644 --- a/renderlib.py +++ b/renderlib.py @@ -91,12 +91,20 @@ def renderFrame(infile, task, outfile): with Image(filename=infile) as img: with img.convert('png') as converted: converted.save(filename=outfile) + elif args.resvg: + # invoke inkscape to convert the generated svg-file into a png inside the .frames-directory + cmd = 'resvg --background white --width={1} --height={2} "{4}" "{3}" 2>&1 >/dev/null'.format(task.workdir, width, height, outfile, infile) + errorReturn = subprocess.check_output(cmd, shell=True, universal_newlines=True, stderr=subprocess.STDOUT, cwd=task.workdir) + if errorReturn != '': + print("resvg exited with error\n" + errorReturn) + # sys.exit(42) + else: # invoke inkscape to convert the generated svg-file into a png inside the .frames-directory cmd = 'inkscape --export-background=white --export-background-opacity=0 --export-width={1} --export-height={2} --export-png="{3}" "{4}" 2>&1 >/dev/null'.format(task.workdir, width, height, outfile, infile) errorReturn = subprocess.check_output(cmd, shell=True, universal_newlines=True, stderr=subprocess.STDOUT, cwd=task.workdir) if errorReturn != '': - print("inkscape exitted with error\n" + errorReturn) + print("inkscape exited with error\n" + errorReturn) # sys.exit(42) def cachedRenderFrame(frame, frameNr, task, cache):