mirror of
https://gitlab.com/oloturia/fumcaso.git
synced 2024-11-01 01:38:16 +01:00
Added merging of cartoons.
Allows cartoons with no text.
This commit is contained in:
parent
77b73cc703
commit
72e9a43123
3 changed files with 63 additions and 48 deletions
38
r2text.csv
38
r2text.csv
|
@ -1,19 +1,19 @@
|
||||||
B00.0.png;
|
B00.0.png
|
||||||
B00.1.png;
|
B00.1.png
|
||||||
B00.2.png;
|
B00.2.png
|
||||||
B01.png;
|
B01.png
|
||||||
B02.png;
|
B02.png
|
||||||
B03.png;
|
B03.png
|
||||||
B04.png;
|
B04.png
|
||||||
B05.png;
|
B05.png
|
||||||
B06.png;
|
B06.png
|
||||||
B07.png;
|
B07.png
|
||||||
B08.png;
|
B08.png
|
||||||
B09.png;
|
B09.png
|
||||||
B10.png;
|
B10.png
|
||||||
B11.png;
|
B11.png
|
||||||
B12.png;
|
B12.png
|
||||||
B13.png;
|
B13.png
|
||||||
B14.png;
|
B14.png
|
||||||
B15.png;
|
B15.png
|
||||||
B16.png;
|
B16.png
|
||||||
|
|
|
47
randstrip.py
47
randstrip.py
|
@ -9,19 +9,25 @@ def fetchText(indText):
|
||||||
with open("rtext.csv") as rtext:
|
with open("rtext.csv") as rtext:
|
||||||
csvReader = csv.reader(rtext,delimiter=';')
|
csvReader = csv.reader(rtext,delimiter=';')
|
||||||
for row in csvReader:
|
for row in csvReader:
|
||||||
if row[0]==indText:
|
if len(row)>1:
|
||||||
return row[1],row[2],row[random.randint(3,len(row)-1)].replace('@','\n')
|
if row[0]==indText:
|
||||||
|
return row[1],row[2],row[random.randint(3,len(row)-1)].replace('@','\n')
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
def fetch2Text(indText):
|
def fetch2Text(indText):
|
||||||
with open("r2text.csv") as rtext:
|
with open("r2text.csv") as rtext:
|
||||||
csvReader = csv.reader(rtext,delimiter=';')
|
csvReader = csv.reader(rtext,delimiter=';')
|
||||||
for row in csvReader:
|
for row in csvReader:
|
||||||
if row[0]==indText:
|
if len(row)>1:
|
||||||
rand1 = random.randint(5,len(row)-1)
|
if row[0]==indText:
|
||||||
if rand1 %2 == 0:
|
rand1 = random.randint(5,len(row)-1)
|
||||||
rand1 +=1
|
if rand1 %2 == 0:
|
||||||
rand2 = rand1+1
|
rand1 +=1
|
||||||
return row[1],row[2],row[3],row[4],row[rand1].replace('@','\n'),row[rand2].replace('@','\n')
|
rand2 = rand1+1
|
||||||
|
return row[1],row[2],row[3],row[4],row[rand1].replace('@','\n'),row[rand2].replace('@','\n')
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
def fetchVign():
|
def fetchVign():
|
||||||
starts = []
|
starts = []
|
||||||
|
@ -40,6 +46,7 @@ def fetchVign():
|
||||||
if story[nvign] == "B00":
|
if story[nvign] == "B00":
|
||||||
story[nvign] += "."
|
story[nvign] += "."
|
||||||
story[nvign] += str(random.randint(0,2))
|
story[nvign] += str(random.randint(0,2))
|
||||||
|
story[nvign]+=".png"
|
||||||
nvign +=1
|
nvign +=1
|
||||||
return story
|
return story
|
||||||
|
|
||||||
|
@ -48,6 +55,7 @@ def addThing(vign):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def writeStrip(story):
|
def writeStrip(story):
|
||||||
|
strip = []
|
||||||
for indVign in story:
|
for indVign in story:
|
||||||
if indVign!="000":
|
if indVign!="000":
|
||||||
vign = Image.open(indVign)
|
vign = Image.open(indVign)
|
||||||
|
@ -55,19 +63,26 @@ def writeStrip(story):
|
||||||
fnt = ImageFont.truetype("ubuntu.ttf",16)
|
fnt = ImageFont.truetype("ubuntu.ttf",16)
|
||||||
if indVign[0] == 'A':
|
if indVign[0] == 'A':
|
||||||
textVign = fetchText(indVign)
|
textVign = fetchText(indVign)
|
||||||
addtext.multiline_text((int(textVign[0]),int(textVign[1])),textVign[2],fill="#000000",font=fnt,align="center")
|
if textVign !=0:
|
||||||
|
addtext.multiline_text((int(textVign[0]),int(textVign[1])),textVign[2],fill="#000000",font=fnt,align="center")
|
||||||
else:
|
else:
|
||||||
textVign = fetch2Text(indVign)
|
textVign = fetch2Text(indVign)
|
||||||
addtext.multiline_text((int(textVign[0]),int(textVign[1])),textVign[4],fill="#000000",font=fnt,align="center")
|
if textVign!=0:
|
||||||
addtext.multiline_text((int(textVign[2]),int(textVign[3])),textVign[5],fill="#000000",font=fnt,align="center")
|
addtext.multiline_text((int(textVign[0]),int(textVign[1])),textVign[4],fill="#000000",font=fnt,align="center")
|
||||||
|
addtext.multiline_text((int(textVign[2]),int(textVign[3])),textVign[5],fill="#000000",font=fnt,align="center")
|
||||||
obj = addThing(indVign)
|
obj = addThing(indVign)
|
||||||
if obj!=(0,0):
|
if obj!=(0,0):
|
||||||
#TODO
|
#TODO
|
||||||
pass
|
pass
|
||||||
|
strip.append(vign)
|
||||||
vign.show()
|
image = Image.new('RGB',(2400,500))
|
||||||
|
xshift=0
|
||||||
|
for vign in strip:
|
||||||
|
image.paste(vign,(xshift,0))
|
||||||
|
xshift += 600
|
||||||
|
return image
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
#story = fetchVign()
|
story = fetchVign()
|
||||||
#writeStrip(story)
|
finalStrip = writeStrip(story)
|
||||||
writeStrip(["A00.png"])
|
finalStrip.show()
|
||||||
|
|
24
rtext.csv
24
rtext.csv
|
@ -1,13 +1,13 @@
|
||||||
A00.png;268;77;Che giornata@del cacchio@oggi;C'è nessuno?;Come vorrei@undolciume;Il telefono non prende;Hey!;Bobby, dove sei?;Ciccioli di mare
|
A00.png;268;77;Che giornata@del cacchio@oggi;C'è nessuno?;Come vorrei@undolciume;Il telefono non prende;Hey!;Bobby, dove sei?;Ciccioli di mare
|
||||||
A01.png;
|
A01.png
|
||||||
A02.png;
|
A02.png
|
||||||
A03.png;
|
A03.png
|
||||||
A04.png;
|
A04.png
|
||||||
A05.png;
|
A05.png
|
||||||
A06.png;
|
A06.png
|
||||||
A07.png;
|
A07.png
|
||||||
A08.png;
|
A08.png
|
||||||
A09.png;
|
A09.png
|
||||||
A10.png;
|
A10.png
|
||||||
A11.png;
|
A11.png
|
||||||
A12.png;
|
A12.png
|
||||||
|
|
|
Loading…
Reference in a new issue