Created
June 12, 2017 02:40
-
-
Save denstilwell/8e01747f6899bac9d24194e20cbb2e8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PIL | |
from PIL import Image | |
import glob | |
import numpy as np | |
import tensorflow as tf | |
import os | |
import imghdr | |
# Load the data set | |
newwidth = 64 | |
newhieght = 64 | |
number = 0 | |
path1 = '/data_set/temp_in' | |
listing = os.listdir(path1) | |
for file in listing: | |
if (imghdr.what('/data_set/temp_in/'+ file) == 'jpeg'): | |
print('jpeg') | |
number = number + 1 | |
img = Image.open('/data_set/temp_in/'+ file) | |
img = img.resize((newwidth,newhieght ), | |
PIL.Image.ANTIALIAS) | |
img.save('/data_set/temp_out/s' + str(number) + '.jpg') | |
print(number) | |
print('all images resized') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment