Skip to content
Snippets Groups Projects
Unverified Commit 4d7e2d22 authored by Yoann Schneider's avatar Yoann Schneider :tennis:
Browse files

fix jpeg images

parent cf3878f4
No related branches found
No related tags found
1 merge request!273Use multithreading to download images at the end, remove cache as we now...
This commit is part of merge request !273. Comments created here will be created in the context of that merge request.
......@@ -5,7 +5,7 @@ from io import BytesIO
from typing import List
import requests
from PIL import Image
from PIL import Image, ImageOps
from tenacity import (
retry,
retry_if_exception_type,
......@@ -56,6 +56,10 @@ def download_image(url):
# Preprocess the image and prepare it for classification
image = Image.open(BytesIO(resp.content))
# Do not rotate JPEG images (see https://github.com/python-pillow/Pillow/issues/4703)
image = ImageOps.exif_transpose(image)
logger.debug(
"Downloaded image {} - size={}x{}".format(url, image.size[0], image.size[1])
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment