Sunday, November 01, 2009

And now for something completely different...

One of the things I spent a day doing at the end of September was add a few bells and whistles to the PAL and VHS plug-ins I wrote for the free software graphics program The GIMP.

I had found there were a few repetitive tasks I tended to do to images when I was making them look like PAL or VHS screen captures and thought I could automate these and include them in my plug-ins.

A major change to both plug-ins was that I made them scale any image fed into them to 720 x 576 (if they were not already that size). This was because the effects simply don't look convincing on images much smaller or larger than actual television resolution.

The main change I made  to my PAL plug-in was to add an optional "interlace" effect.

The new PAL plug-in dialogue box

This is something that is designed to copy the rather stripey way PAL screen shots tend to look. There are many plug-ins that called "de-interlace" available to take the interlace effect out of images but I think this is the first one I've seen that actually puts the interlace in!

The interlace option creates a new layer above your image containing every other scan line from the original image. It then shifts the new layer slightly to the right and blurs it slightly with a light Gaussian Blur. Finally it merges the two layers together which creates the interlace effect.

Here's a picture without interlacing:

Click to enlarge

And here's the same picture with interlacing:

Click to enlarge

You'll definitely need to enlarge the pictures to see the effect, as it's quite subtle.

Another change I made was to add a PAL-S/PAL-D option. These are two different methods of encoding the colour in a PAL picture. PAL-D averages colours across adjacent scanlines in a field. I don't simulate this properly yet, I simply halve the vertical resolution of the luminance which doesn't work very well. If you're interested, Alan Pemberton's site has a wealth of information about PAL.

Here's an image with PAL-S or simple PAL:

Click to enlarge

Here's the same image, but with PAL-D selected:

Click to enlarge

As you can see from the results above, I need to do some major rework on the PAL-D feature, but I'll save that for another day.

There were a few options I added to my VHS plug-in. The first, was to add an option to cut out the VHS picture area - this was because to save space the VHS format did record the whole of a 720 x 576 PAL image - scanlines which weren't visible are not recorded. This is a real shame as, if VHS players did record all the image scanlines, Mike Brown would have an awful lot more vintage teletext on mb21.

You can see the picture area recorded on a VHS tape in a 720 x 576 PAL image below:

Click to enlarge

The next thing I added was a suggestion of Rory Clark. He suggested I simulate a "messy VHS head change", which looks like a distorted area at the bottom of the picture area. You can see what a messy head change created by my VHS plug-in looks like below.

Click to enlarge

Rory also suggested that I might like to add a "glitch" that could appear horizontally across the picture at a particular point. This is what one looks like:

Click to enlarge

I added a slider so you can specify the Y position of the glitch.

The new VHS plug-in dialogue box

There are various other things to add to the plug-in such as comet tails, but I'm quite happy with how it's coming along so far.

If you read the previous article you'll already know that I've licensed my plug-ins under the GPL v3 and they can be downloaded, as usual, from here. Installing the plug-ins tends to be simplicity itself for most GNU/Linux users (simply copy it into your /home/.gimp2.6/plugins folder) but Windows users may need a bit of extra help.

I thought I'd also upload the plug-ins to the official GIMP plug-in registry so that anyone looking for a PAL or VHS plug-in there would be able to stumble across them. They're stored here.

I was particularly pleased that a very helpful chap called "mahvin" who often frequents the registry found a bug in my PAL plug-in, and was even more pleased when he thanked me very nicely indeed for fixing it quickly. This was truly a double bonus as mahvin's site contains his blog which is full of excellent tips on doing all manner of ingenious things in The GIMP and is well worth a read.

Obviously, each picture needs to be taken individually - these plug-ins are just a base to start from, but they have certainly given me a lot of fun, and I hope you'll enjoy playing about with them too.

No comments: