diff --git a/OBJ00.png b/OBJ00.png index 3d61742..873bcda 100644 Binary files a/OBJ00.png and b/OBJ00.png differ diff --git a/OBJ01.png b/OBJ01.png index dcdc60e..dd48fda 100644 Binary files a/OBJ01.png and b/OBJ01.png differ diff --git a/OBJ02.png b/OBJ02.png index 6700aa1..2648328 100644 Binary files a/OBJ02.png and b/OBJ02.png differ diff --git a/OBJ03.png b/OBJ03.png index 48e5fe8..40d08a6 100644 Binary files a/OBJ03.png and b/OBJ03.png differ diff --git a/OBJ04.png b/OBJ04.png index 95c1aaf..fec4492 100644 Binary files a/OBJ04.png and b/OBJ04.png differ diff --git a/OBJ05.png b/OBJ05.png index ad59c69..4078af1 100644 Binary files a/OBJ05.png and b/OBJ05.png differ diff --git a/OBJ06.png b/OBJ06.png index 972f4ae..7e86abc 100644 Binary files a/OBJ06.png and b/OBJ06.png differ diff --git a/OBJ07.png b/OBJ07.png index 7fbaf55..732a562 100644 Binary files a/OBJ07.png and b/OBJ07.png differ diff --git a/OBJ08.png b/OBJ08.png index a2b2761..e56d4fc 100644 Binary files a/OBJ08.png and b/OBJ08.png differ diff --git a/OBJ09.png b/OBJ09.png index 769d7f0..7727873 100644 Binary files a/OBJ09.png and b/OBJ09.png differ diff --git a/obj.csv b/obj.csv index 946f9e4..181d320 100644 --- a/obj.csv +++ b/obj.csv @@ -1,3 +1,3 @@ -A11.png,248,185 -B13.png,256,159 -B14.png,284,148 +A11.png,248,185,OBJ00.png,OBJ01.png,OBJ02.png,OBJ03.png,OBJ04.png,OBJ05.png,OBJ06.png,OBJ07.png,OBJ08.png,OBJ09.png, +B13.png,256,159,OBJ00.png,OBJ01.png,OBJ02.png,OBJ03.png,OBJ04.png,OBJ05.png,OBJ06.png,OBJ07.png,OBJ08.png,OBJ09.png, +B14.png,284,148,OBJ00.png,OBJ01.png,OBJ02.png,OBJ03.png,OBJ04.png,OBJ05.png,OBJ06.png,OBJ07.png,OBJ08.png,OBJ09.png, diff --git a/randstrip.py b/randstrip.py index 6399ae8..3e46f74 100755 --- a/randstrip.py +++ b/randstrip.py @@ -50,15 +50,19 @@ def fetchVign(): nvign +=1 return story -def addThing(vign): - #TODO - pass +def addThing(indVign): + with open("obj.csv") as obj: + csvReader = csv.reader(obj) + for row in csvReader: + if row[0] == indVign: + return row[random.randint(3,len(row)-1)],row[1],row[2] + return 0 def writeStrip(story): strip = [] for indVign in story: if indVign!="000": - vign = Image.open(indVign) + vign = Image.open(indVign).convert('RGBA') addtext = ImageDraw.Draw(vign) fnt = ImageFont.truetype("ubuntu.ttf",16) if indVign[0] == 'A': @@ -71,11 +75,11 @@ def writeStrip(story): 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) - if obj!=(0,0): - #TODO - pass + if obj!=0: + objImg = Image.open(obj[0]) + vign.paste(objImg,(int(obj[1]),int(obj[2]))) strip.append(vign) - image = Image.new('RGB',(2400,500)) + image = Image.new('RGBA',(2400,500)) xshift=0 for vign in strip: image.paste(vign,(xshift,0))