I posted earlier about my need to res down 60000 x 6000 images to 6000 x 6000. I was thinking about using Pixel Bender, but I came up with a workaround that does most of what I’d do in Pixel Bender, needs no programming, and works in all versions of Photoshop. They key idea is to use the bilinear interpolation capabilities of the Photoshop resize tool to do averaging, and to use repeated applications of that tool.

Rather than perform a one-dimensional averaging function explicitly as I was planning to do in Pixel Bender, I do a set of resizes, all with bilinear interpolation: first to 45562 x 6000, then to 30375 x 6000, then to 20250 x 6000, then to 13500 x 6000, then to 9000 x 6000, then to 6000 x 6000. I recorded a Photoshop action to speed things up and minimize mistakes.

Where do those weird numbers come from? Resizing down to 2/3 of the previous horizontal dimension gives me an image populated in equal parts with values from the original image and averages (thanks to the linear interpolation) of adjacent pixels. Repeating the operation spreads out the averaging.

Maybe the best way to visualize it is to look at an example:

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

1 | 2.5 | 4 | 5.5 | 8 | 9.5 | 11 | 12.5 | 14 | |||||

1 | 3.25 | 5.5 | 8.75 | 11 | 13.25 | ||||||||

1 | 4.375 | 8.75 | 12.125 | ||||||||||

1 | 6.5625 | 12.125 |

Using linear interpolation also means that there is no averaging in the vertical direction.

Now, with the averaging done better, I’m seeing signal to noise ratios improve by more than a factor of three. Theory says the improvement should be the square root of ten.

[…] looking into ways to implement nonstandard image processing algorithms in Photoshop. I found a workaround for the May’s problem, but that didn’t stop me from looking for ways to make write my own […]