From 3c1631d2ae327bf5f8d517e1aa31c47f4d17bf91 Mon Sep 17 00:00:00 2001 From: DaBoss Date: Mon, 6 Feb 2023 22:36:19 +0200 Subject: [PATCH] initial tools --- .idea/.gitignore | 0 .idea/atc_edit_photos.iml | 10 ++ .../inspectionProfiles/profiles_settings.xml | 6 + .idea/misc.xml | 4 + .idea/modules.xml | 8 ++ .idea/vcs.xml | 6 + .idea/workspace.xml | 103 ++++++++++++++++++ main.py | 16 +++ move_files.py | 14 +++ resize.py | 23 ++++ 10 files changed, 190 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/atc_edit_photos.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 main.py create mode 100644 move_files.py create mode 100644 resize.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/.idea/atc_edit_photos.iml b/.idea/atc_edit_photos.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/.idea/atc_edit_photos.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..f196685 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..a8b5faa --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..d339c63 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1675715547567 + + + + + + + + + + + + + file://$PROJECT_DIR$/main.py + 8 + + + + + \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..5596b44 --- /dev/null +++ b/main.py @@ -0,0 +1,16 @@ +# This is a sample Python script. + +# Press Shift+F10 to execute it or replace it with your code. +# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. + + +def print_hi(name): + # Use a breakpoint in the code line below to debug your script. + print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. + + +# Press the green button in the gutter to run the script. +if __name__ == '__main__': + print_hi('PyCharm') + +# See PyCharm help at https://www.jetbrains.com/help/pycharm/ diff --git a/move_files.py b/move_files.py new file mode 100644 index 0000000..b624fda --- /dev/null +++ b/move_files.py @@ -0,0 +1,14 @@ +from pathlib import Path + +length = 0 +my_list=[] +for i in Path("").glob('*.jpg'): + + if len(i.stem) < 15: + my_list.append(i.stem) + if i.stem.count('_')>3: + my_list.append(i.stem) + +with open('to_rename.py','w') as file: + file.write(str(my_list)) + diff --git a/resize.py b/resize.py new file mode 100644 index 0000000..298c4ae --- /dev/null +++ b/resize.py @@ -0,0 +1,23 @@ +from PIL import Image +from pathlib import Path + +source = '' +target = '' + +for image in Path(source).glob('*.jpg'): + + img = Image.open(image) + width, height = img.size + + if height > width: + var = height / width + new_width = int(1600 / var) + new_height = 1600 + else: + var = width / height + new_width = 1600 + new_height = int(1600 / var) + + img_final = img.resize((new_width, new_height)) + img_final.save(target + '\\' + image.name, quality=85) + print(f'file{image} ok!')