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 b/Bio-punk/20190124143731.bmp deleted file mode 100644 index 4690e4d..0000000 Binary files a/Bio-punk/20190124143731.bmp and /dev/null differ 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 b/Bio-punk/20190124143818.bmp deleted file mode 100644 index 20f0f8e..0000000 Binary files a/Bio-punk/20190124143818.bmp and /dev/null 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 b/Bio-punk/20190124143909.png deleted file mode 100644 index 440c7ba..0000000 Binary files a/Bio-punk/20190124143909.png and /dev/null 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 b/Bio-punk/20190124143959.bmp deleted file mode 100644 index 3c937e9..0000000 Binary files a/Bio-punk/20190124143959.bmp and /dev/null 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 b/Bio-punk/20190124144017.bmp deleted file mode 100644 index c1321e9..0000000 Binary files a/Bio-punk/20190124144017.bmp and /dev/null 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 b/Bio-punk/20190124144201.bmp deleted file mode 100644 index b97a025..0000000 Binary files a/Bio-punk/20190124144201.bmp and /dev/null 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 b/Bio-punk/20190124144332.bmp deleted file mode 100644 index f08fef5..0000000 Binary files a/Bio-punk/20190124144332.bmp and /dev/null 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 b/Bio-punk/20190124144351.bmp deleted file mode 100644 index 51a1fe8..0000000 Binary files a/Bio-punk/20190124144351.bmp and /dev/null 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/20190124144638.png b/Bio-punk/20190124144638.png deleted file mode 100644 index 4629c6b..0000000 Binary files a/Bio-punk/20190124144638.png and /dev/null differ diff --git a/Bio-punk/20190124144638.png.jpg b/Bio-punk/20190124144638.png.jpg new file mode 100644 index 0000000..f3de04b Binary files /dev/null and b/Bio-punk/20190124144638.png.jpg differ diff --git a/Bio-punk/20190124144705.png b/Bio-punk/20190124144705.png deleted file mode 100644 index c79c496..0000000 Binary files a/Bio-punk/20190124144705.png and /dev/null 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 b/Bio-punk/20190124144740.png deleted file mode 100644 index a2154c5..0000000 Binary files a/Bio-punk/20190124144740.png and /dev/null 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 b/Bio-punk/20190124144824.png deleted file mode 100644 index 1681e6a..0000000 Binary files a/Bio-punk/20190124144824.png and /dev/null 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 b/Bio-punk/20190124144856.png deleted file mode 100644 index d2cd119..0000000 Binary files a/Bio-punk/20190124144856.png and /dev/null 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 b/Bio-punk/20190124144925.png deleted file mode 100644 index 1a8f62d..0000000 Binary files a/Bio-punk/20190124144925.png and /dev/null 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 b/Bio-punk/20190124145008.bmp deleted file mode 100644 index 26545cc..0000000 Binary files a/Bio-punk/20190124145008.bmp and /dev/null 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 b/Bio-punk/20190124145059.png deleted file mode 100644 index 1368b8c..0000000 Binary files a/Bio-punk/20190124145059.png and /dev/null 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