Skip to content

Instantly share code, notes, and snippets.

@diewland
Created January 16, 2019 10:30
Show Gist options
  • Save diewland/f06199277ed7a2f9396745b9c8f49a33 to your computer and use it in GitHub Desktop.
Save diewland/f06199277ed7a2f9396745b9c8f49a33 to your computer and use it in GitHub Desktop.
Convert image to grayscale
from PIL import Image
def to_grayscale(source, dest):
img = Image.open(source)
img = img.convert('L') # grayscale
img.save(dest, quality=100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment