Files
ocr_demo/utils/pillow_util.py
2025-09-28 13:37:21 +08:00

11 lines
327 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from PIL import Image, ImageEnhance
# 加载图片
img = Image.open("fb1df265-5085-4bc2-881b-7674b620c4ac.jpg")
# 增强对比度1.5 倍为示例,你可以调节参数)
enhancer = ImageEnhance.Contrast(img)
img_enhanced = enhancer.enhance(4.0)
# 保存增强后的图像
img_enhanced.save("enhanced_image_pillow.png")