You know what I do on my days off? I work some more. Okay, no, not literally, but I do kind of tend to play around with work-related stuff.
I just discovered something awesome about Photoshop CS5 a couple hours ago when snuffling around in the help files like a truffle pig: data driven graphics. At first, I was a bit puzzled because that really doesn’t sound like a very artsy kind of thing, but it piqued my inner programmer’s curiosity. Turns out that you can basically turn a PSD file into a template, load variables from a text file, and use those variables to do things like change text layers, replace pixels, and hide/show layers.
Of course, I had to give it a try, and after some brief thought, I hit upon the idea of using this functionality to rapidly generate a large number of unique license plates for the Brio, Interceptor, and other vehicles. So, I saved out copies of the Interceptor textures, then cropped them down to just the license plate frames, deleted all superfluous layers, and turned them into license plate templates.
I set them up so I could change the country code and plate text layers on the UK and European plates, and the North American test plates had 4 configurable layers (month of registration, last 2 digits of registration year, serial, and locality). No real reason, I just wanted to see if I could do it.
With the artistic half completed, it was time for the programming bit. I didn’t want to waste my time manually entering license plate data over and over when I could just randomly generate a large amount of data and dump it to a text file that could be loaded in Photoshop. So, I whipped up a rough PHP script and fired up my local install of EasyPHP.
License plates tend to follow a pretty specific format, so it’s not like you can just generate random strings and be done with it. I wrote the script to take a formatting template as input, so I could specify a formatting template like “111-aaa” (3 random numbers, hyphen, 3 random letters), “AA11 AAAA” (2 random alphanumeric characters, 2 random numbers, space, 4 random alphanumeric characters), and so forth. That was fun to do.
I realized shortly after a few rounds of testing that I could literally do any license plate in the world in mass quantities with relatively little work, and it would pretty much only require a different template and formatting string. So, pretty soon, I’m going to be setting up my very own Department of Motor Vehicles next door to Uppity Robots and Ebbles Variations, where you guys can download sheets of unique stick-on license plates for that little bit of extra flavor.
Speaking of which, just for grits and shiggles: here’s a sheet of 570 (yes, that’s not a typo) unique North American-style license plates that I did as a test: licenseplates_test.zip
That’s just a few minutes of hands-on work! All I did was press a few keys, click a few buttons and all of the grunt work was done by Photoshop, Bridge, and OpenOffice.
I’m gonna be modifying the script a bit to randomize the registration date and locality variables for that little extra touch of uniqueness, and also refactoring the data set generation script so I can quickly modify new copies of it to generate plates for a specific country.
Yeah, this is all a bit silly, but it was fun to do, and I don’t often get to exercise both of my core skills at the same time like this.
UPDATE: Here it is! Department of Motor Vehicles