Suppose I have a variable "profile_image" of image file type. I have created the variable like below:
profile_image = request.FILES.get('profile_image', False)
Now I need to convert this image variable to bytes array. How can I do this without saving it to the local drive? I found that file open/read do not work here. I tried like below:
with open(profile_image.name, "rb") as imageFile:
file_stream = imageFile.read()
Please help me. By the way, by converting into bytes array I want to save it to google cloud.
Thank you.