Skip to content

Commit

Permalink
Update and rename invert.py to imageMod.py
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinZhong authored Mar 24, 2022
1 parent 8763f52 commit 680bc33
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion invert.py → imageMod.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
import PIL.ImageOps

# Function to convert multiple files
resource = 'alldatasets/Class1'
resource = 'D:/Folder/of/images/to/convert'

def main():
for count, filename in enumerate(os.listdir(resource)):
src = resource + '/' + filename
img = Image.open(src)
# invert image colour
PIL.ImageOps.invert(img).save(src)

# convert image to Grayscale
#img.convert('LA').save(src)

# Driver Code
if __name__ == '__main__':
Expand Down

0 comments on commit 680bc33

Please sign in to comment.