Skip to content

Instantly share code, notes, and snippets.

@twiddles
Last active May 25, 2017 12:07
Show Gist options
  • Save twiddles/9e9c97821f464236a2b6597ead84366a to your computer and use it in GitHub Desktop.
Save twiddles/9e9c97821f464236a2b6597ead84366a to your computer and use it in GitHub Desktop.
for source in SOURCES:
print('Processing:', source)
try:
img = io.imread(source)
img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
filename = os.path.basename(source)
cv2.imwrite('processed_' + filename, img)
img = cv2.resize(img, (64, 64))
cv2.imwrite('thumbnail_' + filename, img)
except Exception as e:
print('Skipping', source, 'because of', e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment