# models/image_quality.py | |
from PIL import Image | |
from .logging_config import logger | |
def assess_image_quality(img): | |
try: | |
width, height = img.size | |
resolution = width * height | |
quality_score = min(100, resolution // 20000) | |
return { | |
'resolution': f"{width}x{height}", | |
'quality_score': quality_score | |
} | |
except Exception as e: | |
logger.error(f"Error assessing image quality: {str(e)}") | |
return { | |
'resolution': 'unknown', | |
'quality_score': 0 | |
} | |