title: Set Parameters of Screenshot taken by Python
body: <p>I have used the following code to take the screen shot of the web page. 
  From the code I understand that first the complete page is loaded in the frame and then the frame is rendered in painter. The problem I am facing is that some web pages might be very very lengthy in terms of content, but I would just want the screen shot of the first page of website. Is there any way I can handle that?</p>
  
  <pre><code>def capture(self, url, output_file):
      self.load(QUrl(url))
      self.wait_load()
      # set to webpage size
      frame = self.page().mainFrame()
      self.page().setViewportSize(frame.contentsSize())
      # render image
      image = QImage(self.page().viewportSize(), QImage.Format_ARGB32)
      painter = QPainter(image)
      frame.render(painter)
      painter.end()
      print 'saving', output_file
      image.save(output_file)
  </code></pre>
  
  <p>I have tried to set Preferred size of frame with the help of QSize object, but it wont help either.
  Or alternative, is there any way I can crop image?
  Any help is highly appreciated, Thanks.</p>