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Z61zw4ijVttRxZc/IZbwpr+wApI54A7u/bENYg1KNhnoBcNOAui8AUkYAsa/1+pQOQbIXO2HL61pZ7vvXAw0KAMFg+Ojj/NCLfbsrX/GSjx0OKHYY0LM7gJ7f59Vl+4nA+5+7YclUGoH6my/fERUgPeP78yg1mf605toGScuCotdqEEsmAriqvD6/LvFA0XFyKW+NKVJu80GZBKVOBIabGh4Gzz/eW+HdzWGsgu4Z2XD80EagPiu/sxcBhvVF5uxFJ5PvCAB8Ip+MsCc/LilKl2LUDm7LlFKlJGfO1znK6qIftuze3a7HZW3lbum67HOAYDC8HN7/MUf0ijVrMWDvXaA1sVcKt0NDzcUDh2dPaxPYzZj2bSM7AOk9IBfPF2h7p2d6KiqAUnpDzUihAI3xfoAQDcRMnXVwd1Kk7K/PyA6gcQ4QhNEqVsgPHTRchZCovhEBqlDQusP/iY4YOaYoYvDQWV8mRZg7+g+31T44ABguN3zM7++JnfmXX+54rlNYU7AVqKOuqjh3aqvPENsy5u/1oAAwGo0aFSd8royKHVJvNgGtv35bTwGH6SGkZyqoWR70f8wp3c/G9fbXREfiggKgUSClKHXU0+/rBg0i4aOy0hBSNOu7tnB7lFh75WLkhInLlCp0cGdcWEuv1XTEa4ttgwfg6lwQh+9L+se9efMG4pjGVwMAIQRuqxlq9++GmPyFR/exsX0C7rKVhEEFIOngMzMNYQ9kfIFdjh6NADACNcOB/qmsGhSme3ZPQrfddzSAJnMDqy/HaImy8bFRPQUafVl77rNUFPAzv7ZgBr0C2hIU7OtdAIJNvLP111UBne0fCbaergoINvHO1l9XBXS2fyTYeroqINjEO1t//wNQk+JfjM4XQQAAAABJRU5ErkJggg=='
pic = cStringIO.StringIO()
image_string = cStringIO.StringIO(base64.b64decode(rawbase64))
image = Image.open(image_string)
image.save(pic, image.format, quality = 100)
pic.seek(0)
self.response.headers['Content-Type'] = 'image/png'
self.response.write(pic.read())