Use CoreImage with Python – Pre-Built Examples

If you take the time to install Developer Tools with your Tiger installation you get some pretty cool stuff. One example is the pre-built examples of using CoreImage with Python. If you have Developer Tools installed, go to /Developer/Examples/Quartz/Python. You’ll see a bunch of files with a .py extension. One of my favorites is called watermark.py. Download a text editor like TextWrangler or SubEthaEdit and take a look at them. To use it, find a PDF you want to add a watermark to and open up the Terminal and type


python /Developer/Examples/Quartz/Python/watermark.py --text='Some Text' --font-size=48 --color=255,0,0 /path/to/your.pdf ~/test.pdf

Hit enter and sit back. Once you get a command prompt back, look in your home directory and you’ll see a PDF. If you open it you’ll see your example PDF, but with “Some Text” printed down the right side.

This is only one example of the cool stuff you can do with Python and Quartz, but it’s neat to have.

Leave a Reply

Your email address will not be published.