Sony Vegas Script to Change the Pixel Aspect Ratio of Images

I spent far too long getting this to work again because I forgot to transfer the script from one computer to another, and all of the web references to this technique are, shall we say, broken like a character on Battlestar Galactica. So for anyone else who might need this, I give you a Sony Vegas script to change the pixel aspect ratio of all images in your media pool, written in C#.

 * This script sets the Pixel Aspect Ratio of all images to be 0.9091.
 * Author: Stephen Granade      Date: 21 April 2008

using System.Text.RegularExpressions;
using Sony.Vegas;

public class EntryPoint {
  public void FromVegas(Vegas vegas) {
    foreach (Media media in vegas.Project.MediaPool) {
      Match m = Regex.Match(media.FilePath, "(jpe?g|png|gif)");
      if (m.Success) {
        VideoStream vs = media.GetVideoStreamByIndex(0);
        vs.PixelAspectRatio = 0.9091;