title: How to get alpha value of a PNG image with PIL?
body: <p>How to detect if a PNG image has transparent alpha channel or not using PIL?</p>
  
  <pre><code>img = Image.open('example.png', 'r')
  has_alpha = img.mode == 'RGBA'
  </code></pre>
  
  <p>With above code we know whether a PNG image has alpha channel not not but how to get the alpha value?</p>
  
  <p>I didn't find a 'transparency' key in img.info dictionary as described at <a href="http://www.pythonware.com/library/pil/handbook/format-png.htm" rel="noreferrer">PIL's website</a></p>
  
  <p>I'm using Ubuntu and zlib1g, zlibc packages are already installed.</p>