def tokenimage(tokenhash): tokenid = int(tokenhash, 16) if tokenid > (1 << 256) - 1: abort(404) amulet = get_amulet_data(contract, tokenid) if amulet.amulet: img = imagegen.render(amulet.amulet) buf = BytesIO() img.save(buf, 'PNG') buf.seek(0) return send_file(buf, mimetype='image/png') else: return send_file('static/mysterious-amulet.png', mimetype='image/png')
def renderHolding(workingDir, wav_forms, i, x, videoConfig, frames, draw_lookup, cache): state_data = [] for wav_form in wav_forms: introItems = wav_form["data"] maxIntro = wav_form["max_amplitude"] introSlice = SoundSlice(getItem(introItems, i, -1), getItem(introItems, i, 0), getItem(introItems, i, 1), i, x, maxIntro) state_data.append(introSlice) img = render(State(state_data, cache, i, x), videoConfig, draw_lookup) # ~ img.save(os.path.join(workingDir, "holding" + str(x) + ".png"), 'PNG') #print ("Saving: ", x) img.save(frames[x], "PNG")
"IN THE SPRING MY LUNGS\nSTILL SOMEHOW EXPAND.", "A MAN ONCE MAILED ME\nA PIECE OF HIS HEART", "THIS AMULET\nAT ANY PRICE\nFELT LIKE THE TRUTH", "this amulet is a simple token which proves my love's truth", "DON'T WORRY.", "in the early hours of the new year\ni lie on my back\nwaiting.", "All my life I had this\nimage of what a poet\nshould be", "chaiyya chaiyya", "THE REAL AMULET IS THE FRIENDS WE MADE ALONG THE WAY*", "i rove the plazas of gràcia,\ncrowds move by.\n\ncloth on faces", "🚬 👑 🍣", "Winter evening, a leaf, a blue sky above.", "Lethargically good.", "An amulet is a self-aware house? ", "for the data being hashed – this is dire", "😐💘", "🚽", "cYClOtRIMEThYLeNETrinItrAMiNE", "artERioLoscLEroSes", "👦🏼🎣", "aaAaAaaAaAaAAa", "«...i'm dancing in a nutshell»", "We do not do it...", "Yes, I am not sure, I.", ] if __name__ == '__main__': for i, text in enumerate(TEST_AMULETS): img = imagegen.render(text) img.save('test_images/%d.png' % (i, ))