I'm trying to generate dimensional images using a pillow package using python. The problem I'm facing is 'Content-Type gets converting automatically to binary/octet-stream but my original image Content-Type is image/jpeg '
Here is code which I'm using to generate thumbnails
def resize_image(image_path, resized_path, thumbnail_size):
with Image.open(image_path) as image:
image.thumbnail((thumbnail_size["x"], thumbnail_size["y"]))
image.save(resized_path,"JPEG",progressive=True)
Finally found the solution, problem is while uploading the file to s3 you need to specify the content-type explictly.
s3_client.upload_file(upload_path, '{}'.format(bucket),
f'{filename}',ExtraArgs={'ContentType': '{}'.format(mimeType),'Metadata':{}})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.