I am writing a flask application that receives two image URLs as parameters. Traditionally, I would download this images on the server local disk and carry out my image processing operations. I am downloading them using following code.
urllib.request.urlretrieve(image1url, image_id + '.jpg')
After this I read the image using :
original_image = Image.open(image_id + '.jpg')
and carry out my Image Processing operations like crop and applying a few filters.
original_crop = original_image.crop((x, y, x + width / 3, y + height / 3))
Also, I use ImageFilter operations on this image. Now this code will be deployed on a server. If i continue this way I will keep downloading and saving images on the disk of the server. Of course, I understand that deleting the images after I am done with my Image Processing operations is one option. But if I get a few 100 calls per second, I might at some point of time use up a lot of space. The application is multi threaded using the call
app.run(threaded=true)
which works like a charm.
I want to know if there is a way to load an image without using disk storage of the server. Thus reducing the hard disk space requirements of my service.