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 new file mode 100644 index 0000000..949125e Binary files /dev/null and b/Bio-punk/20190124143731.bmp.jpg differ diff --git a/Bio-punk/20190124143818.bmp.jpg b/Bio-punk/20190124143818.bmp.jpg new file mode 100644 index 0000000..275a9bd Binary files /dev/null and b/Bio-punk/20190124143818.bmp.jpg differ diff --git a/Bio-punk/20190124143909.png.jpg b/Bio-punk/20190124143909.png.jpg new file mode 100644 index 0000000..d6d7104 Binary files /dev/null and b/Bio-punk/20190124143909.png.jpg differ diff --git a/Bio-punk/20190124143959.bmp.jpg b/Bio-punk/20190124143959.bmp.jpg new file mode 100644 index 0000000..13cfe04 Binary files /dev/null and b/Bio-punk/20190124143959.bmp.jpg differ diff --git a/Bio-punk/20190124144017.bmp.jpg b/Bio-punk/20190124144017.bmp.jpg new file mode 100644 index 0000000..366df66 Binary files /dev/null and b/Bio-punk/20190124144017.bmp.jpg differ diff --git a/Bio-punk/20190124144201.bmp.jpg b/Bio-punk/20190124144201.bmp.jpg new file mode 100644 index 0000000..92d2dca Binary files /dev/null and b/Bio-punk/20190124144201.bmp.jpg differ diff --git a/Bio-punk/20190124144332.bmp.jpg b/Bio-punk/20190124144332.bmp.jpg new file mode 100644 index 0000000..8540d76 Binary files /dev/null and b/Bio-punk/20190124144332.bmp.jpg differ diff --git a/Bio-punk/20190124144351.bmp.jpg b/Bio-punk/20190124144351.bmp.jpg new file mode 100644 index 0000000..48f130c Binary files /dev/null and b/Bio-punk/20190124144351.bmp.jpg differ diff --git a/Bio-punk/20190124144705.png.jpg b/Bio-punk/20190124144705.png.jpg new file mode 100644 index 0000000..bd15086 Binary files /dev/null and b/Bio-punk/20190124144705.png.jpg differ diff --git a/Bio-punk/20190124144740.png.jpg b/Bio-punk/20190124144740.png.jpg new file mode 100644 index 0000000..9fd6d3b Binary files /dev/null and b/Bio-punk/20190124144740.png.jpg differ diff --git a/Bio-punk/20190124144824.png.jpg b/Bio-punk/20190124144824.png.jpg new file mode 100644 index 0000000..0e58198 Binary files /dev/null and b/Bio-punk/20190124144824.png.jpg differ diff --git a/Bio-punk/20190124144856.png.jpg b/Bio-punk/20190124144856.png.jpg new file mode 100644 index 0000000..1b190c9 Binary files /dev/null and b/Bio-punk/20190124144856.png.jpg differ diff --git a/Bio-punk/20190124144925.png.jpg b/Bio-punk/20190124144925.png.jpg new file mode 100644 index 0000000..53dbea6 Binary files /dev/null and b/Bio-punk/20190124144925.png.jpg differ diff --git a/Bio-punk/20190124145008.bmp.jpg b/Bio-punk/20190124145008.bmp.jpg new file mode 100644 index 0000000..c338279 Binary files /dev/null and b/Bio-punk/20190124145008.bmp.jpg differ diff --git a/Bio-punk/20190124145059.png.jpg b/Bio-punk/20190124145059.png.jpg new file mode 100644 index 0000000..4727220 Binary files /dev/null and b/Bio-punk/20190124145059.png.jpg differ 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