From dea7c5b6a87a342bf3aad049888972e362e6715d Mon Sep 17 00:00:00 2001 From: Jagadeesh R <58656215+RJ535315@users.noreply.github.com> Date: Sun, 11 Apr 2021 11:13:33 +0530 Subject: [PATCH 1/4] python script file pushed --- Image-Sorting/imgSortingScript.py | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Image-Sorting/imgSortingScript.py diff --git a/Image-Sorting/imgSortingScript.py b/Image-Sorting/imgSortingScript.py new file mode 100644 index 0000000000..663ff2a575 --- /dev/null +++ b/Image-Sorting/imgSortingScript.py @@ -0,0 +1,39 @@ +#cv2 is an Image processing library + +import cv2 +#for os manipulation +import os,glob + +#Initializing counts for each resolution category +im_4k = 0 +im_1080 = 0 +im_720 = 0 + +#Creating directories for each resolution type +os.system("mkdir 4K") +os.system("mkdir 1080p") +os.system("mkdir 720p") + #Selecting images one by one +for image in glob.glob('*.jpg'): + print(image) + #Reading the image + img = cv2.imread(image) + #getting the image resolution + height, width, channel = img.shape + #Comparing image resolutions and grouping them accordingly to move to folders + if(width>=3840 and height>=2160): + os.system("move "+image+" 4K") + im_4k = im_4k+1 + continue + if(width>=1920 and height>=1080): + os.system("move "+image+" 1080p") + im_1080 = im_1080+1 + continue + if(width>=1280 and height>=720): + os.system("move "+image+" 720p") + im_720 = im_720+1 + continue +#displaying the counts for each type +print(im_4k," 4K images moved to 4K folder") +print(im_1080," 1080p images moved to 1080p folder") +print(im_720," 720p images moved to 720p folder") From 04434f449deb5a0d344dfa7849af660b00772689 Mon Sep 17 00:00:00 2001 From: Jagadeesh R <58656215+RJ535315@users.noreply.github.com> Date: Sun, 11 Apr 2021 11:18:47 +0530 Subject: [PATCH 2/4] readme file pushed --- Image-Sorting/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Image-Sorting/README.md diff --git a/Image-Sorting/README.md b/Image-Sorting/README.md new file mode 100644 index 0000000000..6f018d8759 --- /dev/null +++ b/Image-Sorting/README.md @@ -0,0 +1,19 @@ + +

Image Sorter

+It is python based script to sort and group jpg files according to the image resolution into separate folders + +--------------------------------------------------------------------- + +## Modules Used +- cv2 +- os +- glob + +## How it works +- It sorts the jpg files according to the image resolution. + +- then it creates separate folders for each resolution type + +- then it moves the jpg files accordingly to the folders + +#### By [Jagadeesh Relli](https://github.com/RJ535315) From 3eb6d83913bc7bab39e592f402cc6b4e15f2a3d7 Mon Sep 17 00:00:00 2001 From: Jagadeesh R <58656215+RJ535315@users.noreply.github.com> Date: Sun, 11 Apr 2021 11:44:19 +0530 Subject: [PATCH 3/4] deleting readme --- Image-Sorting/README.md | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 Image-Sorting/README.md diff --git a/Image-Sorting/README.md b/Image-Sorting/README.md deleted file mode 100644 index 6f018d8759..0000000000 --- a/Image-Sorting/README.md +++ /dev/null @@ -1,19 +0,0 @@ - -

Image Sorter

-It is python based script to sort and group jpg files according to the image resolution into separate folders - ---------------------------------------------------------------------- - -## Modules Used -- cv2 -- os -- glob - -## How it works -- It sorts the jpg files according to the image resolution. - -- then it creates separate folders for each resolution type - -- then it moves the jpg files accordingly to the folders - -#### By [Jagadeesh Relli](https://github.com/RJ535315) From 660f3fbd6362c4680fd946fc0acda873ada4fb86 Mon Sep 17 00:00:00 2001 From: Jagadeesh R <58656215+RJ535315@users.noreply.github.com> Date: Sun, 11 Apr 2021 11:48:08 +0530 Subject: [PATCH 4/4] created readme file according to guidelines --- Image-Sorting/README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Image-Sorting/README.md diff --git a/Image-Sorting/README.md b/Image-Sorting/README.md new file mode 100644 index 0000000000..fce0bed0a6 --- /dev/null +++ b/Image-Sorting/README.md @@ -0,0 +1,29 @@ + +# Package/Script Name + +Image Sorter + +- It is python based script to sort and group jpg files according to the image resolution into separate folders + + +## Setup instructions + +Just run the script where the bunch of jpg files of different resolutions exists. + + +## Output + +- before running the script + +![Screenshot (47)](https://user-images.githubusercontent.com/58656215/114294251-e7e3e980-9aba-11eb-8feb-d5556ac1e770.png) + +- after running the script + +![Screenshot (50)](https://user-images.githubusercontent.com/58656215/114294355-aef84480-9abb-11eb-8445-417216e2179c.png) + +![Screenshot (49)](https://user-images.githubusercontent.com/58656215/114294255-f0d4bb00-9aba-11eb-82e8-d59e74cfdd86.png) + + +## Author(s) + +[Jagadeesh Relli](https://github.com/RJ535315)