glt24: make inkscape rendering usable again
This commit is contained in:
parent
1f8d859bbc
commit
58bc29249e
4 changed files with 23 additions and 18 deletions
|
@ -21,8 +21,8 @@ def introFrames(args):
|
|||
frames = 2*fps
|
||||
for i in range(0, frames):
|
||||
yield(
|
||||
('title', 'style', 'opacity', easeInQuad(i, 0, 1, frames)),
|
||||
('persons', 'style', 'opacity', easeInQuad(i, 0, 1, frames)),
|
||||
('title', 'style', 'opacity', easeInQuad(i, 0.01, 1, frames)),
|
||||
('persons', 'style', 'opacity', easeInQuad(i, 0.01, 1, frames)),
|
||||
)
|
||||
|
||||
#show whole image for 5 seconds
|
||||
|
@ -59,15 +59,15 @@ def debug():
|
|||
'../intro.ts',
|
||||
introFrames,
|
||||
{
|
||||
'$title': "Long Long Long title is LONG",
|
||||
'$speaker': 'Long Name of Dr. Dr. Prof. Dr. Long Long'
|
||||
'$title': " Fully declarative Homelab on NixOS ❄️",
|
||||
'$persons': '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):
|
||||
|
|
|
@ -431,10 +431,10 @@
|
|||
id="tspan5627"
|
||||
x="941.19"
|
||||
y="594.2323"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'Titillium Web';-inkscape-font-specification:'Titillium Web, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;writing-mode:lr-tb;text-anchor:middle">$title</tspan></text>
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'Titillium Web';-inkscape-font-specification:'Titillium Web, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;writing-mode:lr-tb;text-anchor:middle;opacity:0.5">$title</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;opacity:0.5"
|
||||
x="939.93469"
|
||||
y="680.10602"
|
||||
id="persons"><tspan
|
||||
|
@ -442,7 +442,7 @@
|
|||
id="tspan5631"
|
||||
x="939.93469"
|
||||
y="680.10602"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'Titillium Web';-inkscape-font-specification:'Titillium Web, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;fill-opacity:1">$persons</tspan></text>
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'Titillium Web';-inkscape-font-specification:'Titillium Web, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;fill-opacity:1;opacity:1">$persons</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
|
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
4
make.py
4
make.py
|
@ -99,7 +99,9 @@ renderlib.args = args
|
|||
# sys.exit(1)
|
||||
|
||||
|
||||
def render(infile, outfile, sequence, parameters={}, workdir=os.path.join(projectname, 'artwork')):
|
||||
cwd = os.getcwd()
|
||||
|
||||
def render(infile, outfile, sequence, parameters={}, workdir=os.path.join(cwd, projectname, 'artwork')):
|
||||
task = renderlib.Rendertask(infile=infile, outfile=outfile,
|
||||
sequence=sequence, parameters=parameters, workdir=workdir)
|
||||
return renderlib.rendertask(task)
|
||||
|
|
15
renderlib.py
15
renderlib.py
|
@ -97,7 +97,7 @@ def renderFrame(infile, task, outfile):
|
|||
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(
|
||||
cmd = 'resvg --use-fonts-dir ~/.local/share/fonts/ --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)
|
||||
|
@ -107,12 +107,15 @@ def renderFrame(infile, task, outfile):
|
|||
|
||||
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-filename="{3}" "{4}" --pipe 2>&1 >/dev/null'.format(
|
||||
cmd = 'inkscape --export-background=white --export-background-opacity=0 --export-width={1} --export-height={2} --export-filename="{3}" "{4}"'.format(
|
||||
task.workdir, width, height, os.path.abspath(outfile), os.path.abspath(infile))
|
||||
errorReturn = subprocess.check_output(
|
||||
cmd, shell=True, universal_newlines=True, stderr=subprocess.STDOUT, cwd=task.workdir)
|
||||
if errorReturn != '':
|
||||
print("inkscape exited with error\n" + errorReturn)
|
||||
try:
|
||||
errorReturn = subprocess.check_output(
|
||||
cmd, shell=True, universal_newlines=True, stderr=subprocess.STDOUT, cwd=task.workdir)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"inkscape exited with error")
|
||||
print(f"returncode={e.returncode}")
|
||||
print(f"output={e.output}")
|
||||
# sys.exit(42)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue