Wednesday, September 23, 2009

Tapeheads Revisited

I was happily applying my "fake" VHS or fake PAL effects to a range of pictures thinking how clever I'd been when something started to bother me.

Most images looked fine, but some looked completely wrong. For instance, the "Colour Production" text on Yorkshire Television production captions looked awful. I needed to find out what was wrong.

It shouldn't actually look this bad...

I went back to Alan Pemberton's website and after reading this page again I realised what was wrong. A PAL colour picture is composed of a high definition black and white image (which contains the luminance or Y) and a low definition colour image (or chrominance). The luminance image and chrominance images are added together to make a colour image.

However, with the colour turned down, the luminance image looks like a normal black and white picture - complete with all the detail viewers in black and white would expect. Whereas my technique for faking PAL or VHS was chucking away far too much detail, and if I turned down the colour I would certainly not see an acceptable black and white image.

In particular, I was binning far to much information for red and blue, which was the reason that things like the blueish red "Colour Production" on the Yorkshire Television caption looked far to low resolution.

I could quite easily create a PAL luminance image, like this:

A PAL luminance image

And I tried to create a chrominance image, like this one:

PAL chrominance image, but you'll have to imagine the negative colours...

However, when I tried to combine them, something was wrong.

Lightspots can be too light

The answer was that for my chrominance image to work, the PNG format would need to hold negative colour values. The chrominance image is what's called a difference image and therefore contains negative as well as positive values. Alan Pemberton explains why this is much better than I could on his site.

So, I couldn't be completely accurate in the way I created PAL images, but I thought I could do a better job than I had been. So I fired up The GIMP and came up with this.

I load my source image and create two layers. I call the bottom one Luminance, the other Chrominance. I make the Chrominance layer's blend mode Addition.

For my Luminance layer I adjust the Red channel output level to 76, the Green channel output level to 150 and the Blue channel output level to 29.

Setting the Red channel level to 76

For the chrominance layer I adjust the Red channel output level to 179, the Green channel output level to 105 and the Blue channel output level to 226.

You may notice that each pair of numbers adds up to 255. The Luminance (Y) layer values were worked out using:

Y = 0.299R + 0.587G + 0.114B with R = G = B = 255

Then depending on what I am doing (PAL VHS or just PAL), I scale the Luminance and Chrominance layers horizontally and then scale them back to full size. For a nice PAL effect I found that scaling the Luminance layer by two thirds width and then back again and the Chrominance layer to a third width and back again gave a good effect.

For VHS I found scaling the Luminance layer by 32% and the Chrominance layer by 16% looked OK.

As a comparison, here's a Yorkshire television caption done using the revised technique.

How We Used To Live - with lossy old VHS tapes

The next job is to turn my method into plug-in filters for The GIMP. Time to dig out my Python book!

No comments: