# Print to Image

**URL:** <https://forum.inductiveautomation.com/t/print-to-image/4767>\
**Category:** Ignition\
**Created:** [July 5, 2012, 1:07pm UTC](https://forum.inductiveautomation.com/t/print-to-image/4767 "2012-07-05T13:07:33Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Kevin.McClusky](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@Kevin.McClusky](https://forum.inductiveautomation.com/u/Kevin.McClusky)\
**Post date:** [July 6, 2012, 12:15am UTC](https://forum.inductiveautomation.com/t/print-to-image/4767/6 "2012-07-06T00:15:52Z")

</div>

If you feel like getting your hands dirty, you might be able to use your handy mechanical friend, java.awt.robot, to do this for you.

Note: This is pretty advanced, as it digs into the Java API.

Full Code:

```auto

# Capture Test

from java.awt import Robot, Toolkit, Rectangle
from java.io import File
from javax.imageio import ImageIO

robot = Robot()
toolkit = Toolkit.getDefaultToolkit()
dimension = toolkit.getScreenSize()
bufferedImage = robot.createScreenCapture(Rectangle(0, 0, dimension.width, dimension.height))

filepath = system.file.saveFile("screenshot.png", "png", "png file")

if filepath is not None:
	file = File(filepath)
	if ImageIO.write(bufferedImage, "png", file):
		system.gui.messageBox("Image saved.")
	else:
		system.gui.messageBox("Image write failed.")

```

If you want just a part of your screen, you could take the bufferedImage and manipulate it before saving. (or you could pass a different Rectangle to robot.createScreenCapture())

Hope this helps!

---

_[View the full topic](https://forum.inductiveautomation.com/t/print-to-image/4767)._
