Last active
June 24, 2017 15:10
-
-
Save robsonpiere/00189078c2368e342b8f6e964862c3ab to your computer and use it in GitHub Desktop.
Printscreen em python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyscreenshot as ImageGrab | |
def main(): | |
imagens = [] | |
# captura todas as imagens primeiro e deixa na memória | |
for i in range(10): | |
imagens.append(ImageGrab.grab()) | |
print("captura:" + str(i)) | |
# depois de capturadas salva todas | |
for cont, imagem in enumerate(imagens, start=1): | |
# {:02d} -> inteiros com menos de 2 dígitos preenchidos com zero a esquerda | |
imagem.save("imagem_{:02d}.bmp".format(cont)) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment