title: How can I get the depth of a jpg file?
body: <p>I want to retrieve the bit depth for a jpeg file using Python.</p>
  
  <p>Using the Python Imaging Library:</p>
  
  <pre><code>import Image
  data = Image.open('file.jpg')
  print data.depth
  </code></pre>
  
  <p>However, this gives me a depth of 8 for an obviously 24-bit image. Am I doing something wrong? Is there some way to do it with pure Python code?</p>
  
  <p>Thanks in advance.</p>
  
  <p>Edit: It's data.bits not data.depth.</p>