Render: makeScreenshot

makeScreenshot(fileName)
  • Saves a screenshot

fileName:
  • Type: string
     
  • The name and path of the saved screenshot
     
  • Add # to end of the file name to save as a sequentially numbered screenshot
Note:
  • Screenshot image types:  bmp, jpeg, png, targa, etc.
     
  • Screenshot image types are set in:
    Info menu >> Engine Render box >> Blender Render
    Properties menu >> Render >> Output tab >> File Format box
     
  • File format is automatically added to file name
     
  • Example:  if PNG is the image file format
    "myscreenshot" will be saved as myscreenshot.png
    "myscreenshot.jpg" will also be saved as myscreenshot.png
Note:
  • By default, the screenshot is saved to same folder as the saved blend file
     
  • Screenshots can be saved to a different folder.
     
  • "//" = the directory of the blend that is currently running
     
  • Use / or \\ as directory separator in path.
     
  • You can include subdirectories in the path by using ("//" + "subdir_name/")
Sample Code

################  save a screenshot to same folder as the saved blend file

# import bge module
import bge

# get the render module
rend = bge.render

# save a screenshot named myScreenShot
rend.makeScreenshot("//myScreenShot")

Sample Code

################  save a screen shot to a subfolder you created
 
# import bge module
import bge

# get the render module
rend = bge.render

# save myScreenShot to the subfolder named ScreenShot
fileName = "//ScreenShot/myScreenShot"

# save a screenshot
rend.makeScreenshot(fileName)

Sample Code

################  save sequentially numbered screenshots
 
# import bge module
import bge

# get the render module
rend = bge.render

# save sequentially numbered screenshots
fileName = "//myScreenShot#"

# save a screenshot
rend.makeScreenshot(fileName)