I am getting scanned/photographed images from user on my web-app (Python Flask) which inturn is stored in Azure Blob. I need to generalize all images to a standard resolution along with reducing the file size. I intend to apply OCR on these images, so retaining image quality is important too.
I need to do this on my server (python flask) before the image is stored on Azure Blob. I found libraries like picopt
which didn't directly address the issue. There are also some scripts available which can be called from console, but I need to execute them every time automatically.
Sorry for being naive here but can anybody suggest a solution so I can do this within the python flask app?
I am reading the file by file = request.files['file']
. I want to do the processing on the image without saving as I will be storing it in Azure Blob.
Goals
- Monochrom image (Binarize)
- Image compression
- Preserve aspect ratio