Skip to content

Instantly share code, notes, and snippets.

@waqaskhan409
Created April 6, 2019 12:42
Show Gist options
  • Select an option

  • Save waqaskhan409/2b5464b3a2fe20d02c74b03d5564509a to your computer and use it in GitHub Desktop.

Select an option

Save waqaskhan409/2b5464b3a2fe20d02c74b03d5564509a to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# coding: utf-8
# In[3]:
from PIL import Image
import os
# In[37]:
def resizeImages():
for f in os.listdir('c:/OrganizeDatasetWateremlon/sweet/Test/verySweet/'):
if f.endswith('.jpg'):
e = 'c:/OrganizeDatasetWateremlon/sweet/Test/verySweet/' + f
i = Image.open(e)
fn , fext = os.path.splitext(f)
i.thumbnail((300,300))
i.save('c:/OrganizeDatasetWateremlon/sweet/Test/verySweet/{}{}'.format(fn , fext))
# In[ ]:
# In[38]:
resizeImages()
# In[ ]:
# In[ ]:
# In[18]:
# In[ ]:
# In[ ]:
# In[ ]:
# In[ ]:
# In[ ]:
# In[ ]:
# In[ ]:
# In[ ]:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment