The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

Screenshot Grabber

Hi I'm Vee!Hi I'm Vee! Formerly VH; She/Her; Is an E X P E R I E N C ERegistered User regular
edited December 2008 in Help / Advice Forum
Hey, so I'm looking for some good software (preferably free, or at least cheap) that can automatically take a screenshot of a specific window. Like, if I have a window open, and it's not full screen, I want to be able to screenshot just the window, and nothing else. I'd just use Print Screen, but windows in XP are curved on the upper corners, so I can't avoid also screenshotting what's behind it a little bit, at least not without some serious attention to selection.

I'm going to be using this to create hundreds of screenshots, so automating the process as much as possible would be great.

vRyue2p.png
Hi I'm Vee! on

Posts

  • ArikadoArikado Southern CaliforniaRegistered User regular
    edited December 2008
    Print Key does most of that. Don't think it has an automatic setting, though.

    Arikado on
    BNet: Arikado#1153 | Steam | LoL: Anzen
  • GlaealGlaeal Registered User regular
    edited December 2008
    Snagit worked well for me in the past, but I used a much older version than the current one.

    Glaeal on
  • focused7focused7 Registered User regular
    edited December 2008
    alt + print screen captures just the active window

    focused7 on
  • evilmrhenryevilmrhenry Registered User regular
    edited December 2008
    Alright, this was "interesting", but I wanted a program like this myself. So, I made one.

    Important notes:
    * You will need to install python ( http://python.org/ ) PIL ( http://www.pythonware.com/products/pil/ )and Sendkeys ( http://www.rutherfurd.net/python/sendkeys/#sendkeys )
    * Copy and paste the code section into a new text file, and save the file as pyscreencap.py, in a directory by itself.
    * You may need to turn off Numlock. Windows is Weird.
    * Copy-paste is unlikely to work correctly while this program is running, as I'm using Alt+Printscreen to make this work.
    * When switching between windows, it may take a few seconds for the script to switch to the new window. I don't know why.
    * If your windows have rounded edges, the screenshot will include whatever's behind the window in those few pixels. If is a problem, change your window style to classic.
    * If you keep getting "screenshot not acquired" errors, hit Print Screen. This should be fixed now, though.
    #Quick-n-dirty automatic screenshot generator
    
    #By Evil Mr Henry, released as Public Domain.
    
    from Tkinter import *
    from PIL import Image
    import SendKeys
    from PIL import ImageGrab
    import os
    from time import sleep
    
    root = Tk()
    
    global is_this_thing_on
    is_this_thing_on = False
    global after_callback
    after_callback = ""
    global mseconds_interval
    mseconds_interval = 10000
    global dir_to_use
    dir_to_use = ""
    global picture_suffix
    picture_suffix = 10000
    global window_only
    window_only = False
    
    #Actually takes the picture. Uses a callback to loop.
    def take_screen():
    	global dir_to_use
    	global after_callback
    	global mseconds_interval
    	global picture_suffix
    	global window_only
    	
    	if window_only:
    		#Alt+PrtScreen
    		SendKeys.SendKeys("%{PRTSC}")
    		#Give Windows enough time to process the screenshot.
    		sleep(1)
    		tmp_image = ImageGrab.grabclipboard()
    	else:
    		tmp_image = ImageGrab.grab()
    	if not isinstance(tmp_image, Image.Image):
    		log_text.insert(END, "screenshot not acquired.\n")
    		print tmp_image
    	else:
    		tmp_image.save(os.path.join(dir_to_use, "shot"+str(picture_suffix)+".bmp"))
    		log_text.insert(END, "Screenshot acquired: "+str(picture_suffix)+"\n")
    		picture_suffix += 1
    	after_callback = root.after(mseconds_interval, take_screen)
    
    #Start or end taking screenshots.
    def begin_or_end(event=0):
    	global is_this_thing_on
    	global after_callback
    	global mseconds_interval
    	global picture_suffix
    	if not is_this_thing_on:
    		seconds_input=timing_entry.get()
    		if not seconds_input.isdigit():
    			log_text.insert(END, "No seconds between pictures found. Defaulting to 10s\n")
    			mseconds_interval = 10000
    		else:
    			mseconds_interval = int(seconds_input) * 1000
    		is_this_thing_on = True
    		if not os.path.exists(dir_to_use):
    			os.mkdir(dir_to_use)
    		convert_button.config(text="End")
    		take_screen()
    	else:
    		is_this_thing_on = False
    		root.after_cancel(after_callback)
    		convert_button.config(text="Start!")
    
    #Switch between screenshot modes.
    def full_or_window(event=0):
    	global window_only
    	window_only = not window_only
    	if window_only:
    		fullwindow_button.config(text="Window")
    	else:
    		fullwindow_button.config(text="Fullscreen")
    
    for i in range(1000, 10000):
    	if not os.path.exists("screenshots"+str(i)):
    		dir_to_use="screenshots"+str(i)
    		break
    else:
    	#Seriously? You used all the possible directories? Seriously?
    	input_text = Text(root)
    	input_text.grid(column=0, row=0)
    	input_text.insert(END, "Delete some of the sreenshot directories and restart.")
    
    if dir_to_use != "":
    	timing_entry = Entry(root)
    	timing_entry.grid(column=0, row=0, sticky=E, columnspan=2)
    	timing_entry.insert(END, "10")
    	timing_text = Label(root, text="Enter seconds between screenshots here:")
    	timing_text.grid(column=0, row=0, columnspan=2)
    	log_text = Text(root)
    	log_text.grid(column=0, row=1, columnspan=2)
    	convert_button = Button(root, text="Start!", command=begin_or_end)
    	convert_button.grid(column=1, row=2, sticky=E)
    	fullwindow_button = Button(root, text="Fullscreen", command=full_or_window)
    	fullwindow_button.grid(column=0, row=2)
    
    #Windows is Wierd. If I don't do this, future screenshots doesn't work.
    SendKeys.SendKeys("{PRTSC}")
    
    root.mainloop()
    

    evilmrhenry on
  • msh1283msh1283 Registered User regular
    edited December 2008
    Second the recommendation for Snagit. It's a fantastic program.

    msh1283 on
  • SzechuanosaurusSzechuanosaurus Registered User, ClubPA regular
    edited December 2008
    Alright, this was "interesting", but I wanted a program like this myself. So, I made one.
    Important notes:
    * You will need to install python ( http://python.org/ ) PIL ( http://www.pythonware.com/products/pil/ )and Sendkeys ( http://www.rutherfurd.net/python/sendkeys/#sendkeys )
    * Copy and paste the code section into a new text file, and save the file as pyscreencap.py, in a directory by itself.
    * You may need to turn off Numlock. Windows is Weird.
    * Copy-paste is unlikely to work correctly while this program is running, as I'm using Alt+Printscreen to make this work.
    * When switching between windows, it may take a few seconds for the script to switch to the new window. I don't know why.
    * If your windows have rounded edges, the screenshot will include whatever's behind the window in those few pixels. If is a problem, change your window style to classic.
    * If you keep getting "screenshot not acquired" errors, hit Print Screen. This should be fixed now, though.
    #Quick-n-dirty automatic screenshot generator
    
    #By Evil Mr Henry, released as Public Domain.
    
    from Tkinter import *
    from PIL import Image
    import SendKeys
    from PIL import ImageGrab
    import os
    from time import sleep
    
    root = Tk()
    
    global is_this_thing_on
    is_this_thing_on = False
    global after_callback
    after_callback = ""
    global mseconds_interval
    mseconds_interval = 10000
    global dir_to_use
    dir_to_use = ""
    global picture_suffix
    picture_suffix = 10000
    global window_only
    window_only = False
    
    #Actually takes the picture. Uses a callback to loop.
    def take_screen():
    	global dir_to_use
    	global after_callback
    	global mseconds_interval
    	global picture_suffix
    	global window_only
    	
    	if window_only:
    		#Alt+PrtScreen
    		SendKeys.SendKeys("%{PRTSC}")
    		#Give Windows enough time to process the screenshot.
    		sleep(1)
    		tmp_image = ImageGrab.grabclipboard()
    	else:
    		tmp_image = ImageGrab.grab()
    	if not isinstance(tmp_image, Image.Image):
    		log_text.insert(END, "screenshot not acquired.\n")
    		print tmp_image
    	else:
    		tmp_image.save(os.path.join(dir_to_use, "shot"+str(picture_suffix)+".bmp"))
    		log_text.insert(END, "Screenshot acquired: "+str(picture_suffix)+"\n")
    		picture_suffix += 1
    	after_callback = root.after(mseconds_interval, take_screen)
    
    #Start or end taking screenshots.
    def begin_or_end(event=0):
    	global is_this_thing_on
    	global after_callback
    	global mseconds_interval
    	global picture_suffix
    	if not is_this_thing_on:
    		seconds_input=timing_entry.get()
    		if not seconds_input.isdigit():
    			log_text.insert(END, "No seconds between pictures found. Defaulting to 10s\n")
    			mseconds_interval = 10000
    		else:
    			mseconds_interval = int(seconds_input) * 1000
    		is_this_thing_on = True
    		if not os.path.exists(dir_to_use):
    			os.mkdir(dir_to_use)
    		convert_button.config(text="End")
    		take_screen()
    	else:
    		is_this_thing_on = False
    		root.after_cancel(after_callback)
    		convert_button.config(text="Start!")
    
    #Switch between screenshot modes.
    def full_or_window(event=0):
    	global window_only
    	window_only = not window_only
    	if window_only:
    		fullwindow_button.config(text="Window")
    	else:
    		fullwindow_button.config(text="Fullscreen")
    
    for i in range(1000, 10000):
    	if not os.path.exists("screenshots"+str(i)):
    		dir_to_use="screenshots"+str(i)
    		break
    else:
    	#Seriously? You used all the possible directories? Seriously?
    	input_text = Text(root)
    	input_text.grid(column=0, row=0)
    	input_text.insert(END, "Delete some of the sreenshot directories and restart.")
    
    if dir_to_use != "":
    	timing_entry = Entry(root)
    	timing_entry.grid(column=0, row=0, sticky=E, columnspan=2)
    	timing_entry.insert(END, "10")
    	timing_text = Label(root, text="Enter seconds between screenshots here:")
    	timing_text.grid(column=0, row=0, columnspan=2)
    	log_text = Text(root)
    	log_text.grid(column=0, row=1, columnspan=2)
    	convert_button = Button(root, text="Start!", command=begin_or_end)
    	convert_button.grid(column=1, row=2, sticky=E)
    	fullwindow_button = Button(root, text="Fullscreen", command=full_or_window)
    	fullwindow_button.grid(column=0, row=2)
    
    #Windows is Wierd. If I don't do this, future screenshots doesn't work.
    SendKeys.SendKeys("{PRTSC}")
    
    root.mainloop()
    

    But...
    focused7 wrote: »
    alt + print screen captures just the active window

    I mean, good job and all but Microsoft seem to have this one covered?

    Szechuanosaurus on
  • evilmrhenryevilmrhenry Registered User regular
    edited December 2008
    But...
    focused7 wrote: »
    alt + print screen captures just the active window

    I mean, good job and all but Microsoft seem to have this one covered?

    This one automates hitting Alt-Printscreen, and saves everything to a series of files. Hitting alt-printscreen, pasting into paint, then saving gets old rather quickly.
    I'm going to be using this to create hundreds of screenshots, so automating the process as much as possible would be great.

    evilmrhenry on
Sign In or Register to comment.