Skip to content

Instantly share code, notes, and snippets.

@dietercastel
Last active September 9, 2020 08:12
Show Gist options
  • Select an option

  • Save dietercastel/7caf92a37546ff8bcf7b15bae8e9c08d to your computer and use it in GitHub Desktop.

Select an option

Save dietercastel/7caf92a37546ff8bcf7b15bae8e9c08d to your computer and use it in GitHub Desktop.
Convert JPG -> PNG -> INVERTED
from PIL import Image
import PIL.ImageOps
#Using PIL/pillow (install with 'pip3 install pillow' )
name = 'RPS-g2.jpg'
outname = 'RPS-g2.png' #png extension
im = Image.open(name)
inv = PIL.ImageOps.invert(im) #invert opperation
inv.save(outname)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment