Exif rotation, description update
This commit is contained in:
@@ -4,7 +4,7 @@ import io
|
||||
import datetime
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
from PIL import Image, ImageDraw, ImageFont, ImageOps
|
||||
from tools.utils import format_relative_time, ToolError, COMMON_FONTS, get_file_info_list, sort_file_list, get_paginated_list
|
||||
|
||||
logger = logging.getLogger("MattCP")
|
||||
@@ -83,6 +83,8 @@ async def handle(args: Dict[str, Any]):
|
||||
|
||||
try:
|
||||
with Image.open(full_path) as img:
|
||||
# Apply EXIF orientation to fix sideways images
|
||||
img = ImageOps.exif_transpose(img)
|
||||
img.thumbnail((thumb_size, thumb_size))
|
||||
off_x = (thumb_size - img.width) // 2
|
||||
off_y = (thumb_size - img.height) // 2
|
||||
|
||||
Reference in New Issue
Block a user