Sharpening images

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from PIL import ImageEnhance

def _sharpen(image, sharpness=1.6):
    """
	Returns a sharpened copy of an image. 
	
	Resizing down or thumbnailing your images with PIL.Image tends to make them blurry. I apply this snippet to such images in order to regain some sharpness.
	"""
    sharpener = ImageEnhance.Sharpness(image)
    sharpened_image = sharpener.enhance(sharpness)
    return sharpened_image

More like this

  1. Yet Another Image Resizer by stephen_mcd 3 years, 2 months ago
  2. Resize image on save by David 5 years, 1 month ago
  3. Unsharp Mask with PIL and PythonMagick by VidJa 4 years, 4 months ago
  4. ResizeImageField by wim 2 years, 7 months ago
  5. Async PIL resize of images by FarmKing 1 year, 3 months ago

Comments

(Forgotten your password?)