Interpret Photo

Every month or two I do a DVD backup – I backup all my administrative stuff… including estimates, invoices and finished project source code – I also backup weird experiments from a folder called shapevent. I’ve been doing these backups for years and for some reason I decided to dig through them today.I’ve only scratched the surface and I’ve found some interesting stuff that I had completely forgotten about.

The below experiment uses pure code to draw an image inspired by a photo. It doesn’t sample any colors or use any of the image data, the idea was to do everything by “painting” with code. If your feeling impatient, scroll to the bottom to see what kind of image this produces, otherwise sit back and watch:

This movie requires Flash Player 9

Here are two examples of the kinds of images it will generate:

There is some really fun stuff going on in this code. I wrote a mini library when bitmapdata first came out that treated things sort of like photoshop layers, you could make new layers, flatten layers, apply filters and blendmodes to layers – it was pretty nice, surprised I didn’t use it more. I made most of these using it.

The brush motion is a randomly generated bezier path, I wrote weird functions like zigZag() that would aid in the creation of certain types of paths. I remember that you could create any kind of shape and then distort it, so you could do something like :

circle(x, y, radius, smooth, distortion amount).

That’s how the little blobs that make up the brush were created. Looking forward to digging into the source a bit more and maybe porting it to AS3.



 
 
 

Leave a Reply

Spam protection by WP Captcha-Free