How to copy a image from clipboard in Python?
<pre><code>def Clip(self):
    subprocess.call('SnippingTool.exe')
    #ctypes.windll.user32.OpenClipboard(0)
    #ClippedScreen=ctypes.windll.user32.GetClipboardData
    #ClippedScreen=PIL.ImageGrab.grab(bbox=(10,10,500,500))
    ClippedScreen = PIL.ImageGrab.grabclipboard()
    self.savescreenshot(ClippedScreen)
</code></pre>

<ol>
<li><p><code>ImageGrab.grabclipboard()</code> is failing with <code>raise IOError("Unsupported BMP bitfields layout")</code>.  Read in the net that this is a known issue. No idea how to fix this.</p></li>
<li><p>Next tried ctypes, that is failing with <code>AttributeError: '_FuncPtr'</code> object has no attribute 'save'</p></li>
<li><p>bbox is working, but I have no idea of how to make the clipping area dynamic.</p></li>
</ol>

<p>Whole screen grabbing is working fine</p>

<pre><code>def Prntscrn(self):
            WholeScreen=ImageGrab.grab()
            self.savescreenshot(WholeScreen)
</code></pre>

<p>Any help would be great, the idea is to use Snipping Tool to clip the screen and then copy the image from clipboard to a variable and use the savescreenshot method to save it in a folder. Any help would be great.</p>