简体   繁体   中英

clipping an image using a clipboard in python

I want to take a screenshot of whole screen in python which is doable(feasible) to me. But if i want to take screenshot of a desired clipped area like the picture shown below means first of all, user should select(clip) a region using mouse pointer and then take screenshot of that area. So i want to say that how to clip a portion of an image in a clipboard?

NOTE: I have found some packages like "clipboard" and "pyperclip" but i couldn't understand how to clip an image? Help me

I got a code but it shows to clip only text. What modifications should be made in it to clip a desired area of an image.

import clipboard
clipboard.copy("abc") 
text = clipboard.paste() 
print(text)

在此处输入图片说明

I would find a python module that allowed you to edit image files, or use a binding to an external program. A tool like pyperclip will enable you to get at the image in python, you will then have to edit the image yourself using a module or something else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM