title: Resizing images on Google Colab using Python Pillow
body: <p>I've my ipynb and a folder named PRimage (with 100+ images) in my google drive and my drive is already mounted at /content/drive. My images are arranged in sequence eg. 1_1.jpg, 1_2.jpg and so on. I'm trying to use a for loop to resize all images, like this:</p>
  
  <pre><code>from google.colab import drive
  drive.mount('/content/drive')
  
  from os import listdir
  from matplotlib import image
  from PIL import Image
  
  loaded_images = list()
  for filename in listdir('/content/drive/My Drive/PRimage'):
    img_data = image.imread('/content/drive/My Drive/PRimage/'+ filename)
    loaded_images.append(img_data)
    print('&gt; loaded %s %s' % (filename, img_data.shape))
  
  def resize():
      files = listdir('/content/drive/My Drive/PRimage')
      for item in files:
              image = Image.open(item)
              image.thumbnail((64,64))
              print(image.size)
  
  resize()
  </code></pre>
  
  <p>However, I get this error message:</p>
  
  <p><a href="https://i.stack.imgur.com/X2yGZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X2yGZ.png" alt="enter image description here"></a></p>