aboutsummaryrefslogtreecommitdiff
path: root/Bio-punk
diff options
context:
space:
mode:
authorbio-punk <cory@hnu.edu.cn>2019-01-24 20:41:13 +0800
committerbio-punk <cory@hnu.edu.cn>2019-01-24 20:42:14 +0800
commit9204d28650c86fb3bbc48f66b316a0fa4ba234db (patch)
tree038d712bc389d334b6399168ff99a05a60ea1a43 /Bio-punk
parentfd5f277bd7cb5d563d902d197d9ea01ce181bed5 (diff)
downloadDress-9204d28650c86fb3bbc48f66b316a0fa4ba234db.tar
Dress-9204d28650c86fb3bbc48f66b316a0fa4ba234db.tar.gz
Dress-9204d28650c86fb3bbc48f66b316a0fa4ba234db.tar.bz2
Dress-9204d28650c86fb3bbc48f66b316a0fa4ba234db.zip
用python和opencv写了个压缩图片的,图片压缩到1366的jpg格式
压缩了原来的照片
Diffstat (limited to 'Bio-punk')
-rw-r--r--Bio-punk/.gitignore2
-rw-r--r--Bio-punk/20190124143731.bmpbin2665386 -> 0 bytes
-rw-r--r--Bio-punk/20190124143731.bmp.jpgbin0 -> 81733 bytes
-rw-r--r--Bio-punk/20190124143818.bmpbin5499990 -> 0 bytes
-rw-r--r--Bio-punk/20190124143818.bmp.jpgbin0 -> 343535 bytes
-rw-r--r--Bio-punk/20190124143909.pngbin827680 -> 0 bytes
-rw-r--r--Bio-punk/20190124143909.png.jpgbin0 -> 157665 bytes
-rw-r--r--Bio-punk/20190124143959.bmpbin649566 -> 0 bytes
-rw-r--r--Bio-punk/20190124143959.bmp.jpgbin0 -> 46306 bytes
-rw-r--r--Bio-punk/20190124144017.bmpbin1109574 -> 0 bytes
-rw-r--r--Bio-punk/20190124144017.bmp.jpgbin0 -> 100097 bytes
-rw-r--r--Bio-punk/20190124144201.bmpbin6748950 -> 0 bytes
-rw-r--r--Bio-punk/20190124144201.bmp.jpgbin0 -> 555930 bytes
-rw-r--r--Bio-punk/20190124144332.bmpbin2868534 -> 0 bytes
-rw-r--r--Bio-punk/20190124144332.bmp.jpgbin0 -> 160194 bytes
-rw-r--r--Bio-punk/20190124144351.bmpbin3674934 -> 0 bytes
-rw-r--r--Bio-punk/20190124144351.bmp.jpgbin0 -> 254696 bytes
-rw-r--r--Bio-punk/20190124144638.pngbin746172 -> 0 bytes
-rw-r--r--Bio-punk/20190124144638.png.jpgbin0 -> 180264 bytes
-rw-r--r--Bio-punk/20190124144705.pngbin902963 -> 0 bytes
-rw-r--r--Bio-punk/20190124144705.png.jpgbin0 -> 213113 bytes
-rw-r--r--Bio-punk/20190124144740.pngbin923246 -> 0 bytes
-rw-r--r--Bio-punk/20190124144740.png.jpgbin0 -> 242458 bytes
-rw-r--r--Bio-punk/20190124144824.pngbin1608723 -> 0 bytes
-rw-r--r--Bio-punk/20190124144824.png.jpgbin0 -> 605190 bytes
-rw-r--r--Bio-punk/20190124144856.pngbin1319044 -> 0 bytes
-rw-r--r--Bio-punk/20190124144856.png.jpgbin0 -> 250894 bytes
-rw-r--r--Bio-punk/20190124144925.pngbin1132964 -> 0 bytes
-rw-r--r--Bio-punk/20190124144925.png.jpgbin0 -> 428759 bytes
-rw-r--r--Bio-punk/20190124145008.bmpbin2051862 -> 0 bytes
-rw-r--r--Bio-punk/20190124145008.bmp.jpgbin0 -> 155785 bytes
-rw-r--r--Bio-punk/20190124145059.pngbin775895 -> 0 bytes
-rw-r--r--Bio-punk/20190124145059.png.jpgbin0 -> 178329 bytes
-rw-r--r--Bio-punk/zipPhoto.py27
34 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 b/Bio-punk/20190124143731.bmp
deleted file mode 100644
index 4690e4d..0000000
--- a/Bio-punk/20190124143731.bmp
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124143731.bmp.jpg b/Bio-punk/20190124143731.bmp.jpg
new file mode 100644
index 0000000..949125e
--- /dev/null
+++ b/Bio-punk/20190124143731.bmp.jpg
Binary files differ
diff --git a/Bio-punk/20190124143818.bmp b/Bio-punk/20190124143818.bmp
deleted file mode 100644
index 20f0f8e..0000000
--- a/Bio-punk/20190124143818.bmp
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124143818.bmp.jpg b/Bio-punk/20190124143818.bmp.jpg
new file mode 100644
index 0000000..275a9bd
--- /dev/null
+++ b/Bio-punk/20190124143818.bmp.jpg
Binary files differ
diff --git a/Bio-punk/20190124143909.png b/Bio-punk/20190124143909.png
deleted file mode 100644
index 440c7ba..0000000
--- a/Bio-punk/20190124143909.png
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124143909.png.jpg b/Bio-punk/20190124143909.png.jpg
new file mode 100644
index 0000000..d6d7104
--- /dev/null
+++ b/Bio-punk/20190124143909.png.jpg
Binary files differ
diff --git a/Bio-punk/20190124143959.bmp b/Bio-punk/20190124143959.bmp
deleted file mode 100644
index 3c937e9..0000000
--- a/Bio-punk/20190124143959.bmp
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124143959.bmp.jpg b/Bio-punk/20190124143959.bmp.jpg
new file mode 100644
index 0000000..13cfe04
--- /dev/null
+++ b/Bio-punk/20190124143959.bmp.jpg
Binary files differ
diff --git a/Bio-punk/20190124144017.bmp b/Bio-punk/20190124144017.bmp
deleted file mode 100644
index c1321e9..0000000
--- a/Bio-punk/20190124144017.bmp
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124144017.bmp.jpg b/Bio-punk/20190124144017.bmp.jpg
new file mode 100644
index 0000000..366df66
--- /dev/null
+++ b/Bio-punk/20190124144017.bmp.jpg
Binary files differ
diff --git a/Bio-punk/20190124144201.bmp b/Bio-punk/20190124144201.bmp
deleted file mode 100644
index b97a025..0000000
--- a/Bio-punk/20190124144201.bmp
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124144201.bmp.jpg b/Bio-punk/20190124144201.bmp.jpg
new file mode 100644
index 0000000..92d2dca
--- /dev/null
+++ b/Bio-punk/20190124144201.bmp.jpg
Binary files differ
diff --git a/Bio-punk/20190124144332.bmp b/Bio-punk/20190124144332.bmp
deleted file mode 100644
index f08fef5..0000000
--- a/Bio-punk/20190124144332.bmp
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124144332.bmp.jpg b/Bio-punk/20190124144332.bmp.jpg
new file mode 100644
index 0000000..8540d76
--- /dev/null
+++ b/Bio-punk/20190124144332.bmp.jpg
Binary files differ
diff --git a/Bio-punk/20190124144351.bmp b/Bio-punk/20190124144351.bmp
deleted file mode 100644
index 51a1fe8..0000000
--- a/Bio-punk/20190124144351.bmp
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124144351.bmp.jpg b/Bio-punk/20190124144351.bmp.jpg
new file mode 100644
index 0000000..48f130c
--- /dev/null
+++ b/Bio-punk/20190124144351.bmp.jpg
Binary files differ
diff --git a/Bio-punk/20190124144638.png b/Bio-punk/20190124144638.png
deleted file mode 100644
index 4629c6b..0000000
--- a/Bio-punk/20190124144638.png
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124144638.png.jpg b/Bio-punk/20190124144638.png.jpg
new file mode 100644
index 0000000..f3de04b
--- /dev/null
+++ b/Bio-punk/20190124144638.png.jpg
Binary files differ
diff --git a/Bio-punk/20190124144705.png b/Bio-punk/20190124144705.png
deleted file mode 100644
index c79c496..0000000
--- a/Bio-punk/20190124144705.png
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124144705.png.jpg b/Bio-punk/20190124144705.png.jpg
new file mode 100644
index 0000000..bd15086
--- /dev/null
+++ b/Bio-punk/20190124144705.png.jpg
Binary files differ
diff --git a/Bio-punk/20190124144740.png b/Bio-punk/20190124144740.png
deleted file mode 100644
index a2154c5..0000000
--- a/Bio-punk/20190124144740.png
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124144740.png.jpg b/Bio-punk/20190124144740.png.jpg
new file mode 100644
index 0000000..9fd6d3b
--- /dev/null
+++ b/Bio-punk/20190124144740.png.jpg
Binary files differ
diff --git a/Bio-punk/20190124144824.png b/Bio-punk/20190124144824.png
deleted file mode 100644
index 1681e6a..0000000
--- a/Bio-punk/20190124144824.png
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124144824.png.jpg b/Bio-punk/20190124144824.png.jpg
new file mode 100644
index 0000000..0e58198
--- /dev/null
+++ b/Bio-punk/20190124144824.png.jpg
Binary files differ
diff --git a/Bio-punk/20190124144856.png b/Bio-punk/20190124144856.png
deleted file mode 100644
index d2cd119..0000000
--- a/Bio-punk/20190124144856.png
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124144856.png.jpg b/Bio-punk/20190124144856.png.jpg
new file mode 100644
index 0000000..1b190c9
--- /dev/null
+++ b/Bio-punk/20190124144856.png.jpg
Binary files differ
diff --git a/Bio-punk/20190124144925.png b/Bio-punk/20190124144925.png
deleted file mode 100644
index 1a8f62d..0000000
--- a/Bio-punk/20190124144925.png
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124144925.png.jpg b/Bio-punk/20190124144925.png.jpg
new file mode 100644
index 0000000..53dbea6
--- /dev/null
+++ b/Bio-punk/20190124144925.png.jpg
Binary files differ
diff --git a/Bio-punk/20190124145008.bmp b/Bio-punk/20190124145008.bmp
deleted file mode 100644
index 26545cc..0000000
--- a/Bio-punk/20190124145008.bmp
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124145008.bmp.jpg b/Bio-punk/20190124145008.bmp.jpg
new file mode 100644
index 0000000..c338279
--- /dev/null
+++ b/Bio-punk/20190124145008.bmp.jpg
Binary files differ
diff --git a/Bio-punk/20190124145059.png b/Bio-punk/20190124145059.png
deleted file mode 100644
index 1368b8c..0000000
--- a/Bio-punk/20190124145059.png
+++ /dev/null
Binary files differ
diff --git a/Bio-punk/20190124145059.png.jpg b/Bio-punk/20190124145059.png.jpg
new file mode 100644
index 0000000..4727220
--- /dev/null
+++ b/Bio-punk/20190124145059.png.jpg
Binary files 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