Created
September 17, 2023 12:44
-
-
Save hui-shao/42d33e60448ec2a7a4917c04b64d68a3 to your computer and use it in GitHub Desktop.
图像反色。拖放触发。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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