FabrikaHradekTour/utils/downgrade.py
Václav Šmejkal 60d8cbe3f2
added my python utils
I used this to make this project happen
2023-06-02 21:02:06 +02:00

18 lines
482 B
Python

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()