added my python utils
I used this to make this project happen
This commit is contained in:
parent
21e37fcf21
commit
60d8cbe3f2
18
utils/downgrade.py
Normal file
18
utils/downgrade.py
Normal file
@ -0,0 +1,18 @@
|
||||
import os
|
||||
from PIL import Image
|
||||
|
||||
def main():
|
||||
for file in os.listdir(os.fsencode(".")):
|
||||
filename = os.fsdecode(file)
|
||||
|
||||
if not filename.endswith(".jpg"): continue
|
||||
|
||||
foo = Image.open(filename)
|
||||
|
||||
if foo.size[0] <= 3000 and foo.size[1] <= 3000: continue
|
||||
|
||||
foo = foo.resize((1500, int((1500 / foo.size[0]) * foo.size[1])), Image.LANCZOS)
|
||||
foo.save("downscaled/" + filename, quality=95)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
15
utils/rename.py
Normal file
15
utils/rename.py
Normal file
@ -0,0 +1,15 @@
|
||||
import os
|
||||
|
||||
def main():
|
||||
number = 1
|
||||
|
||||
for file in os.listdir(os.fsencode(".")):
|
||||
filename = os.fsdecode(file)
|
||||
|
||||
if not filename.endswith(".py"):
|
||||
os.rename(filename, str(number) + "." + filename.split(".")[1])
|
||||
number += 1
|
||||
#print(number)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user