Skip to content

Instantly share code, notes, and snippets.

@yoya
Last active August 16, 2018 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoya/8670e7dd2c91b9bf59dd90ecd19eb323 to your computer and use it in GitHub Desktop.
Save yoya/8670e7dd2c91b9bf59dd90ecd19eb323 to your computer and use it in GitHub Desktop.
pil_imageops_equalize.py
from PIL import Image, ImageOps
import sys
im = Image.open(sys.argv[1])
im = im.convert("YCbCr")
yy, cb, cr = im.split()
yy = ImageOps.equalize(yy);
im = Image.merge("YCbCr", (yy, cb, cr))
im = im.convert("RGB")
im.show()
# im.save(sys.argv[2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment