title: Beautiful Soup: get picture size from html
body: <p>I want to extract the pictures' widths and heights using Bueatiful Soup. All pictures have the same code format: </p>
  
  <pre><code>&lt;img src="http://somelink.com/somepic.jpg" width="200" height="100"&gt;
  </code></pre>
  
  <p>I can extract the links easily with</p>
  
  <pre><code>for pic in soup.find_all('img'):
      print (pic['src'])
  </code></pre>
  
  <p>But</p>
  
  <pre><code>for pic in soup.find_all('img'):
      print (pic['width'])
  </code></pre>
  
  <p>is not working for extracting sizes. What am I missing?</p>
  
  <p><strong>EDIT:</strong>
  One of the pictures in the page does not have the width and height in the html code. Did not notice this at the time of the initial post. So any solution must take this into account</p>