Reputation: 396
Is there a way I can convert the Image() object to blob?
If I want to serve an image which is created by pgmagick to a HTTP request without writing it on the disk, I see converting the image object to blob and then streaming back to the request is the only option.
Let me know if there are any alternatives to achieve this.
Below is the code sample which creates an image.
from flask import Flask
from pgmagick import Image, Geometry, Color, \
DrawableText
app = Flask(__name__)
@app.route("/")
def hello():
image = Image(Geometry(300,300), Color("yellow"))
image.fontPointsize(30)
text = DrawableText(30,200, "hello stackoverflow")
image.draw(text)
#return image.Blob() # is there any similar functions?
if __name__ == "__main__":
app.run()
I am looking for a wrapper on this: http://www.graphicsmagick.org/api/blob.html#imagetoblob
Upvotes: 0
Views: 233