Changing the "Resize Generated Media" script to 3840 x 2160 pixels ?

Steve_Rhoden wrote on 12/10/2023, 6:58 AM

Hello, Can anyone assist in showing me where to adjust in this "Resize Generated Media" script that came with vegas, to let it resize the generated Media instead to (3840 x 2160) pixels ?..... Or better yet, simply doubling the Project Size / Aspect Ratio?

What i wanna do is simply double the resolution of my (1920 x 1080) HD text media projects, so that after rendering, my texts remain sharp and strong......Thanks...

@jetdv @wwaag

/**
 * This script resizes all generated media to match the size and pixel
 * aspect ratio of the project. The script will operate on the
 * selected video event or, if none are selected, it will operate on
 * all video events.
 *
 * Revision Date: March 26, 2010.
 **/

using System;
using System.Drawing;
using System.Collections.Generic;
using ScriptPortal.Vegas;

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Size projectSize = new Size(vegas.Project.Video.Width, vegas.Project.Video.Height);
        double projectAspect = vegas.Project.Video.PixelAspectRatio;

        List<VideoEvent> events = new List<VideoEvent>();
        AddSelectedVideoEvents(vegas, events);
        if (0 == events.Count)
        {
            AddAllVideoEvents(vegas, events);
        }
        
        foreach (VideoEvent videoEvent in events)
        {
            Take take = videoEvent.ActiveTake;
            if (null == take) continue;
            VideoStream videoStream = take.MediaStream as VideoStream;
            if (null == videoStream) continue;
            if (!videoStream.Parent.IsGenerated()) continue;
            videoStream.Size = projectSize;
            videoStream.PixelAspectRatio = projectAspect;
        }
    }

    void AddSelectedVideoEvents(Vegas vegas, List<VideoEvent> events)
    {
        foreach (Track track in vegas.Project.Tracks)
        {
            if (track.IsVideo())
            {
                foreach (VideoEvent videoEvent in track.Events)
                {
                    if (videoEvent.Selected)
                    {
                        events.Add(videoEvent);
                    }
                }
            }
        }
    }

    void AddAllVideoEvents(Vegas vegas, List<VideoEvent> events)
    {
        foreach (Track track in vegas.Project.Tracks)
        {
            if (track.IsVideo())
            {
                foreach (VideoEvent videoEvent in track.Events)
                {
                    events.Add(videoEvent);
                }
            }
        }
    }
        
}

Comments

jetdv wrote on 12/10/2023, 7:34 AM

@Steve_Rhoden, try this line:

Size projectSize = new Size(vegas.Project.Video.Width, vegas.Project.Video.Height);

It's setting it to the project Width/Height. You could just enter the numbers you want there or even just add " * 2" to both of them:
 

Size projectSize = new Size(3840, 2160);

or

Size projectSize = new Size(vegas.Project.Video.Width * 2, vegas.Project.Video.Height * 2);

 

Steve_Rhoden wrote on 12/10/2023, 9:35 AM

Much appreciated again Edward..... For many years i have often entered these figures manually (sheeeeesh), Glad to end that nonsense lol 😄😄