commit 713317c80968b926c1c3dfcdf511188061daa063
parent 93e29f84f6b18bac31bce31637abef9cb849bc07
Author: rra <rscmbbng@riseup.net>
Date: Sun Mar 28 17:28:36 +0200
one to ten
Diffstat:13 files changed, 149 insertions(+), 0 deletions(-)
diff --git a/thehmm_graphics/drawing.svg b/thehmm_graphics/drawing.svg
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="800"
+ height="600"
+ viewBox="0 0 211.66666 158.75"
+ version="1.1"
+ id="svg8"
+ inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
+ sodipodi:docname="drawing.svg">
+ <defs
+ id="defs2" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.94117647"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.7"
+ inkscape:cx="46.07143"
+ inkscape:cy="369.27377"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ units="px"
+ inkscape:pagecheckerboard="false"
+ inkscape:window-width="1920"
+ inkscape:window-height="1019"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-138.24998)">
+ <rect
+ style="fill:#7800ff;fill-opacity:1;stroke:none;stroke-width:4.96759939;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect950"
+ width="212.8006"
+ height="159.12799"
+ x="-0.75595391"
+ y="138.24998" />
+ <g
+ id="g4533"
+ transform="translate(-8.6688996e-7,1.0261536e-5)">
+ <text
+ id="text12-3-3"
+ y="266.49734"
+ x="14.477193"
+ style="font-style:normal;font-weight:normal;font-size:11.11249924px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:#7800ff;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
+ xml:space="preserve"><tspan
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:105.83333588px;font-family:'F5.6';-inkscape-font-specification:'F5.6';fill:#ffffff;fill-opacity:1;stroke:#7800ff;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
+ y="266.49734"
+ x="14.477193"
+ id="tspan10-5-6"
+ sodipodi:role="line">08</tspan></text>
+ <text
+ id="text12-3-3-3"
+ y="261.2056"
+ x="19.768862"
+ style="font-style:normal;font-weight:normal;font-size:11.11249924px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:#7800ff;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
+ xml:space="preserve"><tspan
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:105.83333588px;font-family:'F5.6';-inkscape-font-specification:'F5.6';fill:#ffffff;fill-opacity:1;stroke:#7800ff;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
+ y="261.2056"
+ x="19.768862"
+ id="tspan10-5-6-6"
+ sodipodi:role="line">08</tspan></text>
+ </g>
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4521"
+ style="fill:black;fill-opacity:1;stroke:none;font-family:sans-serif;font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;letter-spacing:0px;word-spacing:0px"><flowRegion
+ id="flowRegion4523"><rect
+ id="rect4525"
+ width="1185.7142"
+ height="802.85712"
+ x="-232.85715"
+ y="-130" /></flowRegion><flowPara
+ id="flowPara4527"></flowPara></flowRoot> </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="Layer 2" />
+</svg>
diff --git a/thehmm_graphics/generator.py b/thehmm_graphics/generator.py
@@ -0,0 +1,32 @@
+# tool to convert texts to images. needs an SVG as a template. See line 16
+# (c) roel roscam abbing 2018
+# gplv3
+import os,base64,sys
+count = 1
+svg = open(sys.argv[1]).read() #an svg template
+text = open(sys.argv[2]).read() #a text file
+magic_word = '08'
+
+if not os.path.exists('output'):
+ os.mkdir('output')
+
+for sentence in text.split('\n'):
+ files = []
+ for word in sentence.split(' '):
+ fn = 'output/{}.svg'.format(word)
+ with open(fn, 'w') as f:
+ f.write(svg.replace(magic_word, word))
+ files.append(fn)
+ if sentence:
+ try:
+ of = 'output/{}.jpg'.format(str(count).zfill(3))
+
+ #command = "convert -delay 1 -alpha set -dispose previous {} {}".format(" ".join(files),of)
+ command = "convert {} {}".format(" ".join(files),of)
+ print(command)
+ os.system(command)
+ count+=1
+ except:
+ print('skipped', sentence)
+ pass
+ os.system('rm {}'.format(' '.join(files)))+
\ No newline at end of file
diff --git a/thehmm_graphics/output/001.jpg b/thehmm_graphics/output/001.jpg
Binary files differ.
diff --git a/thehmm_graphics/output/002.jpg b/thehmm_graphics/output/002.jpg
Binary files differ.
diff --git a/thehmm_graphics/output/003.jpg b/thehmm_graphics/output/003.jpg
Binary files differ.
diff --git a/thehmm_graphics/output/004.jpg b/thehmm_graphics/output/004.jpg
Binary files differ.
diff --git a/thehmm_graphics/output/005.jpg b/thehmm_graphics/output/005.jpg
Binary files differ.
diff --git a/thehmm_graphics/output/006.jpg b/thehmm_graphics/output/006.jpg
Binary files differ.
diff --git a/thehmm_graphics/output/007.jpg b/thehmm_graphics/output/007.jpg
Binary files differ.
diff --git a/thehmm_graphics/output/008.jpg b/thehmm_graphics/output/008.jpg
Binary files differ.
diff --git a/thehmm_graphics/output/009.jpg b/thehmm_graphics/output/009.jpg
Binary files differ.
diff --git a/thehmm_graphics/output/010.jpg b/thehmm_graphics/output/010.jpg
Binary files differ.
diff --git a/thehmm_graphics/text b/thehmm_graphics/text
@@ -0,0 +1,10 @@
+01
+02
+03
+04
+05
+06
+07
+08
+09
+ 10