title: Image.open() cannot identify image file - Python?
body: <p>I am running Python 2.7 in Visual Studio 2013. The code previously worked ok when in Spyder, but when I run:</p>
  
  <pre><code>import numpy as np
  import scipy as sp
  import math as mt
  import matplotlib.pyplot as plt
  import Image
  import random
  
  # (0, 1) is N
  SCALE = 2.2666 # the scale is chosen to be 1 m = 2.266666666 pixels
  MIN_LENGTH = 150 # pixels
  
  PROJECT_PATH = 'C:\\cimtrack_v1'
  im = Image.open(PROJECT_PATH + '\\ST.jpg')
  </code></pre>
  
  <p>I end up with the following errors:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "C:\cimtrack_v1\PythonApplication1\dr\trajgen.py", line 19, in &lt;module&gt;
      im = Image.open(PROJECT_PATH + '\\ST.jpg')
    File "C:\Python27\lib\site-packages\PIL\Image.py", line 2020, in open
      raise IOError("cannot identify image file")
  IOError: cannot identify image file
  </code></pre>
  
  <p>Why is it so and how may I fix it?</p>
  
  <hr>
  
  <p>As suggested, I have used the Pillow installer to my Python 2.7. But weirdly, I end up with this:</p>
  
  <pre><code>&gt;&gt;&gt; from PIL import Image
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ImportError: No module named PIL
  
  
  &gt;&gt;&gt; from pil import Image
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ImportError: No module named pil
  
  &gt;&gt;&gt; import PIL.Image
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ImportError: No module named PIL.Image
  
  &gt;&gt;&gt; import PIL
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ImportError: No module named PIL
  </code></pre>
  
  <p><strong>All fail!</strong></p>