Merge pull request #310 from bio-punk/master

删掉了有其他人的照片
This commit is contained in:
XHidamariSketchX 2019-01-27 11:49:52 +08:00 committed by GitHub
commit 1982688fbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 29 additions and 0 deletions

2
Bio-punk/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/*.bmp
/*.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

27
Bio-punk/zipPhoto.py Normal file
View File

@ -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))