Saving Images

If you haven't saved anything, it could be a good idea to go ahead and do it now. From the File menu you'll find Save As, where you'll be prompted to find a location to save the Python script that you're writing. There's a second menu option for Save PDF to save the image you're drawing in the PDF format.

If you'd like to save your image in a different format, you can really easily do this directly in your code. Adding a line with a call to the function saveImage() with a path name will let you save your image in one of 10 formats.

Download: file
saveImage("/path/to/image.jpg")

Be sure that the path name in quotes doesn't already exist (or DrawBot will overwrite the file that's there!)

Since the folder names on your computer and my computer are different you might need to pay attention to the code examples that I provide from here on out — I'll be saving images to the Desktop folder with this path name:

Download: file
saveImage("/Users/USERNAME/Desktop/myImage.pdf")

Simply replace the USERNAME with your own user name, and the image will save as a file directly to your Desktop each time you run the script. You can find your user name at the top of the sidebar in a new Finder window, for example my user name is clymer.

If you copy one of my code examples and forget to change the USERNAME, DrawBot will give you an error.

This guide was first published on Dec 14, 2018. It was last updated on Dec 14, 2018.
This page (Saving Images) was last updated on Jun 25, 2020.