diff options
-rw-r--r-- | Bio-punk/.gitignore | 2 | ||||
-rw-r--r-- | Bio-punk/20190124143731.bmp.jpg | bin | 0 -> 81733 bytes | |||
-rw-r--r-- | Bio-punk/20190124143818.bmp.jpg | bin | 0 -> 343535 bytes | |||
-rw-r--r-- | Bio-punk/20190124143909.png.jpg | bin | 0 -> 157665 bytes | |||
-rw-r--r-- | Bio-punk/20190124143959.bmp.jpg | bin | 0 -> 46306 bytes | |||
-rw-r--r-- | Bio-punk/20190124144017.bmp.jpg | bin | 0 -> 100097 bytes | |||
-rw-r--r-- | Bio-punk/20190124144201.bmp.jpg | bin | 0 -> 555930 bytes | |||
-rw-r--r-- | Bio-punk/20190124144332.bmp.jpg | bin | 0 -> 160194 bytes | |||
-rw-r--r-- | Bio-punk/20190124144351.bmp.jpg | bin | 0 -> 254696 bytes | |||
-rw-r--r-- | Bio-punk/20190124144705.png.jpg | bin | 0 -> 213113 bytes | |||
-rw-r--r-- | Bio-punk/20190124144740.png.jpg | bin | 0 -> 242458 bytes | |||
-rw-r--r-- | Bio-punk/20190124144824.png.jpg | bin | 0 -> 605190 bytes | |||
-rw-r--r-- | Bio-punk/20190124144856.png.jpg | bin | 0 -> 250894 bytes | |||
-rw-r--r-- | Bio-punk/20190124144925.png.jpg | bin | 0 -> 428759 bytes | |||
-rw-r--r-- | Bio-punk/20190124145008.bmp.jpg | bin | 0 -> 155785 bytes | |||
-rw-r--r-- | Bio-punk/20190124145059.png.jpg | bin | 0 -> 178329 bytes | |||
-rw-r--r-- | Bio-punk/zipPhoto.py | 27 |
17 files changed, 29 insertions, 0 deletions
diff --git a/Bio-punk/.gitignore b/Bio-punk/.gitignore new file mode 100644 index 0000000..39ba4e8 --- /dev/null +++ b/Bio-punk/.gitignore @@ -0,0 +1,2 @@ +/*.bmp +/*.png diff --git a/Bio-punk/20190124143731.bmp.jpg b/Bio-punk/20190124143731.bmp.jpg Binary files differnew file mode 100644 index 0000000..949125e --- /dev/null +++ b/Bio-punk/20190124143731.bmp.jpg diff --git a/Bio-punk/20190124143818.bmp.jpg b/Bio-punk/20190124143818.bmp.jpg Binary files differnew file mode 100644 index 0000000..275a9bd --- /dev/null +++ b/Bio-punk/20190124143818.bmp.jpg diff --git a/Bio-punk/20190124143909.png.jpg b/Bio-punk/20190124143909.png.jpg Binary files differnew file mode 100644 index 0000000..d6d7104 --- /dev/null +++ b/Bio-punk/20190124143909.png.jpg diff --git a/Bio-punk/20190124143959.bmp.jpg b/Bio-punk/20190124143959.bmp.jpg Binary files differnew file mode 100644 index 0000000..13cfe04 --- /dev/null +++ b/Bio-punk/20190124143959.bmp.jpg diff --git a/Bio-punk/20190124144017.bmp.jpg b/Bio-punk/20190124144017.bmp.jpg Binary files differnew file mode 100644 index 0000000..366df66 --- /dev/null +++ b/Bio-punk/20190124144017.bmp.jpg diff --git a/Bio-punk/20190124144201.bmp.jpg b/Bio-punk/20190124144201.bmp.jpg Binary files differnew file mode 100644 index 0000000..92d2dca --- /dev/null +++ b/Bio-punk/20190124144201.bmp.jpg diff --git a/Bio-punk/20190124144332.bmp.jpg b/Bio-punk/20190124144332.bmp.jpg Binary files differnew file mode 100644 index 0000000..8540d76 --- /dev/null +++ b/Bio-punk/20190124144332.bmp.jpg diff --git a/Bio-punk/20190124144351.bmp.jpg b/Bio-punk/20190124144351.bmp.jpg Binary files differnew file mode 100644 index 0000000..48f130c --- /dev/null +++ b/Bio-punk/20190124144351.bmp.jpg diff --git a/Bio-punk/20190124144705.png.jpg b/Bio-punk/20190124144705.png.jpg Binary files differnew file mode 100644 index 0000000..bd15086 --- /dev/null +++ b/Bio-punk/20190124144705.png.jpg diff --git a/Bio-punk/20190124144740.png.jpg b/Bio-punk/20190124144740.png.jpg Binary files differnew file mode 100644 index 0000000..9fd6d3b --- /dev/null +++ b/Bio-punk/20190124144740.png.jpg diff --git a/Bio-punk/20190124144824.png.jpg b/Bio-punk/20190124144824.png.jpg Binary files differnew file mode 100644 index 0000000..0e58198 --- /dev/null +++ b/Bio-punk/20190124144824.png.jpg diff --git a/Bio-punk/20190124144856.png.jpg b/Bio-punk/20190124144856.png.jpg Binary files differnew file mode 100644 index 0000000..1b190c9 --- /dev/null +++ b/Bio-punk/20190124144856.png.jpg diff --git a/Bio-punk/20190124144925.png.jpg b/Bio-punk/20190124144925.png.jpg Binary files differnew file mode 100644 index 0000000..53dbea6 --- /dev/null +++ b/Bio-punk/20190124144925.png.jpg diff --git a/Bio-punk/20190124145008.bmp.jpg b/Bio-punk/20190124145008.bmp.jpg Binary files differnew file mode 100644 index 0000000..c338279 --- /dev/null +++ b/Bio-punk/20190124145008.bmp.jpg diff --git a/Bio-punk/20190124145059.png.jpg b/Bio-punk/20190124145059.png.jpg Binary files differnew file mode 100644 index 0000000..4727220 --- /dev/null +++ b/Bio-punk/20190124145059.png.jpg diff --git a/Bio-punk/zipPhoto.py b/Bio-punk/zipPhoto.py new file mode 100644 index 0000000..5036255 --- /dev/null +++ b/Bio-punk/zipPhoto.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +import cv2 +from os import listdir +from re import match +from re import I as flag +import numpy as np + +def resize_width(image, width=1200): + power = width * 1.0 / image.shape[1] + dim = (width, int(image.shape[0] * power)) + resized = cv2.resize(image, dim, interpolation=cv2.INTER_AREA) + return resized + +def zip_photo(filepath): + targetWidth = 1366 + image = cv2.imread(filepath) + if image.shape[0] > targetWidth: + image = resize_width(image=image, width = targetWidth) + cv2.imwrite("{}.jpg".format(filepath), image) + +dirpath = "." +for filename in listdir(dirpath): + ans = match("^(.*)[.]((png)|(bmp)|(jpg)|(jpeg))$", filename, flag) + if ans is not None: + print (filename) + zip_photo("{}/{}".format(dirpath, filename))
\ No newline at end of file |