Skip to content

Instantly share code, notes, and snippets.

@robsonpiere
Last active June 24, 2017 15:10
Show Gist options
  • Save robsonpiere/00189078c2368e342b8f6e964862c3ab to your computer and use it in GitHub Desktop.
Save robsonpiere/00189078c2368e342b8f6e964862c3ab to your computer and use it in GitHub Desktop.
Printscreen em python
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