Skip to content

Instantly share code, notes, and snippets.

@hui-shao
Created September 17, 2023 12:44
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 hui-shao/42d33e60448ec2a7a4917c04b64d68a3 to your computer and use it in GitHub Desktop.
Save hui-shao/42d33e60448ec2a7a4917c04b64d68a3 to your computer and use it in GitHub Desktop.
图像反色。拖放触发。
from PIL import Image, ImageChops
import sys
def invert_color(fname):
im = Image.open(fname)
im_inverted = ImageChops.invert(im)
im_inverted.save(fname.replace('.', '_inverted.'))
return im_inverted
if __name__ == '__main__':
invert_color(sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment