📝⚙️ (Script) Vegas Text To PNG Image?

Comments

Wiew wrote on 1/14/2023, 1:01 PM

If I need a text png or something else , like a logo ? I work the other way

I create it in paintshop pro and export it as a png , and I animate it in Hitfilm or maybe Vegas

Last changed by Wiew on 1/14/2023, 1:02 PM, changed a total of 1 times.

Camera's ; Panasonic HC-X1 / Panasonic FZ2000 / DJI mini 3 pro drone

Hardware ; AMD Ryzen 9 5900X / MSI Radeon RX 6750XT / 32GB Ram

Screen ; BenQ 27" 4K

My showreel

m3lquixd wrote on 1/14/2023, 1:38 PM

@jetdv Damn!!!! You are amazing man!
Thank you very, very, very much!
The script worked perfectly!

Last changed by m3lquixd on 1/14/2023, 1:39 PM, changed a total of 1 times.

About me:
Hi! Melqui Calheiros Here. I've been using Vegas as my only video editor for over 10 years. I edit professionally for various influencers, public bodies and small businesses. My goal is to squeeze Vegas to the fullest! And end the prejudice that software has here in Brazil.

⬇️ Some of my jobs. ⬇️
https://www.vegascreativesoftware.info/us/forum/post-your-vegas-creations--109464/?page=37#ca872169

PC Specs:
Operating System:
    Windows 11 Pro 64-bit
CPU:
    AMD Ryzen 3 3200G 3.60 GHz
RAM:
    16,0GB Dual-Channel DDR4 2666MHz
Motherboard:
    Gigabyte Technology Co. Ltd. A320M-S2H-CF (AM4)
Graphics:
    4095MB NVIDIA GeForce GTX 1650 (ZOTAC International)
Storage:
    465GB Seagate ST500DM002-1BD142 (SATA )
    238GB Lexar 256GB SSD (SATA (SSD))

m3lquixd wrote on 1/14/2023, 2:17 PM

@jetdv I think you managed to solve my problem.
But I promised I would send a video explaining why I needed it. @Dexcon @3POINT

Timestamp:
0:00 1.0 Creating a project.
0:27 1.1 It's Photoshop time.
0:48 1.2 Now replace everything.
1:12 2.0 What I need.
1:36 2.1 A good solution.



I could do the subtitles directly in Photoshop instead of doing it first in Vegas and replacing it later. But I prefer to do it directly in Vegas, so I don't have to: Stop what I'm doing; Go to photoshop; Write there; Export; And put it in vegas. Besides if I want to change some detail, like some abbreviation... I'll have to go to photoshop again, export again... So I lose all my disposition!

About me:
Hi! Melqui Calheiros Here. I've been using Vegas as my only video editor for over 10 years. I edit professionally for various influencers, public bodies and small businesses. My goal is to squeeze Vegas to the fullest! And end the prejudice that software has here in Brazil.

⬇️ Some of my jobs. ⬇️
https://www.vegascreativesoftware.info/us/forum/post-your-vegas-creations--109464/?page=37#ca872169

PC Specs:
Operating System:
    Windows 11 Pro 64-bit
CPU:
    AMD Ryzen 3 3200G 3.60 GHz
RAM:
    16,0GB Dual-Channel DDR4 2666MHz
Motherboard:
    Gigabyte Technology Co. Ltd. A320M-S2H-CF (AM4)
Graphics:
    4095MB NVIDIA GeForce GTX 1650 (ZOTAC International)
Storage:
    465GB Seagate ST500DM002-1BD142 (SATA )
    238GB Lexar 256GB SSD (SATA (SSD))

jetdv wrote on 1/14/2023, 2:42 PM

@m3lquixd thanks. And you can get back to the text box (if changes need to be made) by just going to the event and pressing "T". The new images were simply added as a new "take". Or you can remove the text takes - this script will keep only the "Active" take and remove all other takes.

Or this script could be modified to remove the text take first if that's what was desired.

It could also be modified to run only on selected events so if you needed to run it a second time but only on a couple of changed events, it wouldn't regenerate everything. There's lots of modifications that could be made. It's just a matter of making it work the way you need it to work.

And I set it up so it would take the "center" frame from each event. That could also be modified to be the first frame, last frame, or any other frame.

m3lquixd wrote on 1/14/2023, 2:47 PM

The new images were simply added as a new "take".

I saw! Very good!

There's lots of modifications that could be made. It's just a matter of making it work the way you need it to work.

But then I need to study how a script works. Because I don't understand ANYTHING! hahaha
Especially since I'm not fluent in English...

About me:
Hi! Melqui Calheiros Here. I've been using Vegas as my only video editor for over 10 years. I edit professionally for various influencers, public bodies and small businesses. My goal is to squeeze Vegas to the fullest! And end the prejudice that software has here in Brazil.

⬇️ Some of my jobs. ⬇️
https://www.vegascreativesoftware.info/us/forum/post-your-vegas-creations--109464/?page=37#ca872169

PC Specs:
Operating System:
    Windows 11 Pro 64-bit
CPU:
    AMD Ryzen 3 3200G 3.60 GHz
RAM:
    16,0GB Dual-Channel DDR4 2666MHz
Motherboard:
    Gigabyte Technology Co. Ltd. A320M-S2H-CF (AM4)
Graphics:
    4095MB NVIDIA GeForce GTX 1650 (ZOTAC International)
Storage:
    465GB Seagate ST500DM002-1BD142 (SATA )
    238GB Lexar 256GB SSD (SATA (SSD))

m3lquixd wrote on 1/14/2023, 4:04 PM

@jetdv Would it be possible to make the images always be saved in the folder where the project is?
Automatically. Without me having to change the location within the script.
And have it automatically create a subfolder for the images.
It is possible?

Last changed by m3lquixd on 1/14/2023, 4:08 PM, changed a total of 1 times.

About me:
Hi! Melqui Calheiros Here. I've been using Vegas as my only video editor for over 10 years. I edit professionally for various influencers, public bodies and small businesses. My goal is to squeeze Vegas to the fullest! And end the prejudice that software has here in Brazil.

⬇️ Some of my jobs. ⬇️
https://www.vegascreativesoftware.info/us/forum/post-your-vegas-creations--109464/?page=37#ca872169

PC Specs:
Operating System:
    Windows 11 Pro 64-bit
CPU:
    AMD Ryzen 3 3200G 3.60 GHz
RAM:
    16,0GB Dual-Channel DDR4 2666MHz
Motherboard:
    Gigabyte Technology Co. Ltd. A320M-S2H-CF (AM4)
Graphics:
    4095MB NVIDIA GeForce GTX 1650 (ZOTAC International)
Storage:
    465GB Seagate ST500DM002-1BD142 (SATA )
    238GB Lexar 256GB SSD (SATA (SSD))

m3lquixd wrote on 1/14/2023, 4:10 PM

@jetdv Another thing. I saw that it captures snapshots from the middle of the event. Would it be possible to be at the beginning? In the exact first frame of each event?

About me:
Hi! Melqui Calheiros Here. I've been using Vegas as my only video editor for over 10 years. I edit professionally for various influencers, public bodies and small businesses. My goal is to squeeze Vegas to the fullest! And end the prejudice that software has here in Brazil.

⬇️ Some of my jobs. ⬇️
https://www.vegascreativesoftware.info/us/forum/post-your-vegas-creations--109464/?page=37#ca872169

PC Specs:
Operating System:
    Windows 11 Pro 64-bit
CPU:
    AMD Ryzen 3 3200G 3.60 GHz
RAM:
    16,0GB Dual-Channel DDR4 2666MHz
Motherboard:
    Gigabyte Technology Co. Ltd. A320M-S2H-CF (AM4)
Graphics:
    4095MB NVIDIA GeForce GTX 1650 (ZOTAC International)
Storage:
    465GB Seagate ST500DM002-1BD142 (SATA )
    238GB Lexar 256GB SSD (SATA (SSD))

jetdv wrote on 1/14/2023, 4:30 PM

@jetdv Would it be possible to make the images always be saved in the folder where the project is?

@m3lquixd Yes, certainly! You need to change this line to point to the correct path/folder. (we'll put a full version of the modified script below)

string FullFileName = "D:\\VidTemp\\Track" + (myTrack.Index + 1) + " Event" + (evnt.Index + 1) + ".png";

Let's assume it creates a new folder each time it's run so we'll make the folder the date/time. And it also has to verify it has now been saved - otherwise it won't know what path to use. So it's now going to check that it has a path to save to, add a new folder for the year month day - hour minute second, and then place all images inside that dated folder.

@jetdv Another thing. I saw that it captures snapshots from the middle of the event. Would it be possible to be at the beginning? In the exact first frame of each event?

Yes, I specifically said this:

And I set it up so it would take the "center" frame from each event. That could also be modified to be the first frame, last frame, or any other frame.

So, of course, it can be set to take the first frame. This line tells where it is going to take the frame from:

myVegas.Transport.CursorPosition = evnt.Start + Timecode.FromFrames(evnt.Length.FrameCount / 2);

We just need to get rid of + Timecode.FromFrames(evnt.Length.FrameCount / 2);

So here's the new modified script:

using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using ScriptPortal.Vegas;

namespace Test_Script
{
    public class Class1
    {
        public Vegas myVegas;

        public void Main(Vegas vegas)
        {
            myVegas = vegas;

            if (myVegas.Project.IsUntitled)
            {
                MessageBox.Show("The project has not yet been saved. You must save the project before you can run this script");
                return;
            }

            string filePath = myVegas.Project.FilePath;
            DateTime currentTime = DateTime.Now;
            filePath = filePath + Path.DirectorySeparatorChar + currentTime.ToString("yyyyMMdd-hhmmss");
            Directory.CreateDirectory(filePath);

            VideoRenderQuality origPreviewRenderQuality = myVegas.Project.Preview.RenderQuality;
            bool origPreviewFillSize = myVegas.Project.Preview.FullSize;
            VideoFieldOrder origFieldOrder = myVegas.Project.Video.FieldOrder;
            VideoDeinterlaceMethod origProjectDeinterlaceMethod = myVegas.Project.Video.DeinterlaceMethod;

            myVegas.Project.Preview.RenderQuality = VideoRenderQuality.Best;
            myVegas.Project.Preview.FullSize = true;
            myVegas.Project.Video.FieldOrder = VideoFieldOrder.ProgressiveScan;
            myVegas.Project.Video.DeinterlaceMethod = VideoDeinterlaceMethod.InterpolateFields;

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.Selected && myTrack.IsVideo())
                {
                    foreach (TrackEvent evnt in myTrack.Events)
                    {
                        myVegas.Transport.CursorPosition = evnt.Start + Timecode.FromFrames(evnt.Length.FrameCount / 2);
                        myVegas.UpdateUI();

                        string FullFileName = filePath + Path.DirectorySeparatorChar + (myTrack.Index + 1) + " Event" + (evnt.Index + 1) + ".png";
                        if (myVegas.SaveSnapshot(FullFileName, ImageFileFormat.PNG, myVegas.Transport.CursorPosition) == RenderStatus.Complete)
                        {
                            VideoEvent vEvent = (VideoEvent)evnt;
                            Media mymedia = new Media(FullFileName);
                            MediaStream stream = mymedia.Streams.GetItemByMediaType(MediaType.Video, 0);
                            Take myNewTake = new Take(stream);
                            vEvent.Takes.Add(myNewTake);

                            myVegas.UpdateUI();
                        }
                    }
                }
            }

            myVegas.Project.Preview.RenderQuality = origPreviewRenderQuality;
            myVegas.Project.Preview.FullSize = origPreviewFillSize;
            myVegas.Project.Video.FieldOrder = origFieldOrder;
            myVegas.Project.Video.DeinterlaceMethod = origProjectDeinterlaceMethod;
        }
    }
}

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}

 

m3lquixd wrote on 1/14/2023, 4:48 PM

@jetdv

About me:
Hi! Melqui Calheiros Here. I've been using Vegas as my only video editor for over 10 years. I edit professionally for various influencers, public bodies and small businesses. My goal is to squeeze Vegas to the fullest! And end the prejudice that software has here in Brazil.

⬇️ Some of my jobs. ⬇️
https://www.vegascreativesoftware.info/us/forum/post-your-vegas-creations--109464/?page=37#ca872169

PC Specs:
Operating System:
    Windows 11 Pro 64-bit
CPU:
    AMD Ryzen 3 3200G 3.60 GHz
RAM:
    16,0GB Dual-Channel DDR4 2666MHz
Motherboard:
    Gigabyte Technology Co. Ltd. A320M-S2H-CF (AM4)
Graphics:
    4095MB NVIDIA GeForce GTX 1650 (ZOTAC International)
Storage:
    465GB Seagate ST500DM002-1BD142 (SATA )
    238GB Lexar 256GB SSD (SATA (SSD))

jetdv wrote on 1/14/2023, 4:54 PM

@m3lquixd Sorry about that. Try this one.
 

using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using ScriptPortal.Vegas;

namespace Test_Script
{
    public class Class1
    {
        public Vegas myVegas;

        public void Main(Vegas vegas)
        {
            myVegas = vegas;

            if (myVegas.Project.IsUntitled)
            {
                MessageBox.Show("The project has not yet been saved. You must save the project before you can run this script");
                return;
            }

            string filePath =  Path.GetDirectoryName(myVegas.Project.FilePath);
            DateTime currentTime = DateTime.Now;
            filePath = filePath + Path.DirectorySeparatorChar + currentTime.ToString("yyyyMMdd-hhmmss");
            Directory.CreateDirectory(filePath);

            VideoRenderQuality origPreviewRenderQuality = myVegas.Project.Preview.RenderQuality;
            bool origPreviewFillSize = myVegas.Project.Preview.FullSize;
            VideoFieldOrder origFieldOrder = myVegas.Project.Video.FieldOrder;
            VideoDeinterlaceMethod origProjectDeinterlaceMethod = myVegas.Project.Video.DeinterlaceMethod;

            myVegas.Project.Preview.RenderQuality = VideoRenderQuality.Best;
            myVegas.Project.Preview.FullSize = true;
            myVegas.Project.Video.FieldOrder = VideoFieldOrder.ProgressiveScan;
            myVegas.Project.Video.DeinterlaceMethod = VideoDeinterlaceMethod.InterpolateFields;

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.Selected && myTrack.IsVideo())
                {
                    foreach (TrackEvent evnt in myTrack.Events)
                    {
                        myVegas.Transport.CursorPosition = evnt.Start + Timecode.FromFrames(evnt.Length.FrameCount / 2);
                        myVegas.UpdateUI();

                        string FullFileName = filePath + Path.DirectorySeparatorChar + (myTrack.Index + 1) + " Event" + (evnt.Index + 1) + ".png";
                        if (myVegas.SaveSnapshot(FullFileName, ImageFileFormat.PNG, myVegas.Transport.CursorPosition) == RenderStatus.Complete)
                        {
                            VideoEvent vEvent = (VideoEvent)evnt;
                            Media mymedia = new Media(FullFileName);
                            MediaStream stream = mymedia.Streams.GetItemByMediaType(MediaType.Video, 0);
                            Take myNewTake = new Take(stream);
                            vEvent.Takes.Add(myNewTake);

                            myVegas.UpdateUI();
                        }
                    }
                }
            }

            myVegas.Project.Preview.RenderQuality = origPreviewRenderQuality;
            myVegas.Project.Preview.FullSize = origPreviewFillSize;
            myVegas.Project.Video.FieldOrder = origFieldOrder;
            myVegas.Project.Video.DeinterlaceMethod = origProjectDeinterlaceMethod;
        }
    }
}

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}

 

m3lquixd wrote on 1/14/2023, 5:04 PM

@jetdv Perfect! 👏👏 I'm forever grateful! 😀

About me:
Hi! Melqui Calheiros Here. I've been using Vegas as my only video editor for over 10 years. I edit professionally for various influencers, public bodies and small businesses. My goal is to squeeze Vegas to the fullest! And end the prejudice that software has here in Brazil.

⬇️ Some of my jobs. ⬇️
https://www.vegascreativesoftware.info/us/forum/post-your-vegas-creations--109464/?page=37#ca872169

PC Specs:
Operating System:
    Windows 11 Pro 64-bit
CPU:
    AMD Ryzen 3 3200G 3.60 GHz
RAM:
    16,0GB Dual-Channel DDR4 2666MHz
Motherboard:
    Gigabyte Technology Co. Ltd. A320M-S2H-CF (AM4)
Graphics:
    4095MB NVIDIA GeForce GTX 1650 (ZOTAC International)
Storage:
    465GB Seagate ST500DM002-1BD142 (SATA )
    238GB Lexar 256GB SSD (SATA (SSD))

Robert Johnston wrote on 4/10/2023, 10:17 PM

I just noticed that the PNG files that are created have an alpha channel property of straight unmatted. If the original source alpha channel is premultiplied, you may not get the same image. You'll will see a difference between Take 1 and Take 2. For example, legacy text 4 (Hot) has a premultiplied alpha channel, but after running the script, the newly created PNG file has straight unmatted alpha channel. If the new file is to look like the original, its properties need to be changed so that the alpha channel is also premultiplied.

Intel Core i7 10700K CPU @ 3.80GHz (to 4.65GHz), NVIDIA GeForce RTX 2060 SUPER 8GBytes. Memory 32 GBytes DDR4. Also Intel UHD Graphics 630. Mainboard: Dell Inc. PCI-Express 3.0 (8.0 GT/s) Comet Lake. Bench CPU Multi Thread: 5500.5 per CPU-Z.

Vegas Pro 21.0 (Build 108) with Mocha Vegas

Windows 11 not pro

m3lquixd wrote on 4/11/2023, 6:44 AM

@Robert Johnston The image does not inherit the Alpha Channel type from the text, no. The generated image is straight, and the text remains premultiplied. From what I've tested here...

About me:
Hi! Melqui Calheiros Here. I've been using Vegas as my only video editor for over 10 years. I edit professionally for various influencers, public bodies and small businesses. My goal is to squeeze Vegas to the fullest! And end the prejudice that software has here in Brazil.

⬇️ Some of my jobs. ⬇️
https://www.vegascreativesoftware.info/us/forum/post-your-vegas-creations--109464/?page=37#ca872169

PC Specs:
Operating System:
    Windows 11 Pro 64-bit
CPU:
    AMD Ryzen 3 3200G 3.60 GHz
RAM:
    16,0GB Dual-Channel DDR4 2666MHz
Motherboard:
    Gigabyte Technology Co. Ltd. A320M-S2H-CF (AM4)
Graphics:
    4095MB NVIDIA GeForce GTX 1650 (ZOTAC International)
Storage:
    465GB Seagate ST500DM002-1BD142 (SATA )
    238GB Lexar 256GB SSD (SATA (SSD))

jetdv wrote on 4/11/2023, 7:31 AM

@Robert Johnston, the script is doing the same as pushing the "snapshot" button above the preview screen. It has no option for setting the alpha channel. That is not controlled by the script.

myVegas.SaveSnapshot(FullFileName, ImageFileFormat.PNG, myVegas.Transport.CursorPosition)

 

richardpohl wrote on 5/3/2023, 10:58 PM

The tools of the Vegasaur can do that. But it is a paid extension. https://vegasaur.com/Vegasaur

I made a little video showing how to do it using Vegasaur

Very cool! Are there more Vegasaur tutorials available somewhere?

VEGAS Pro 20 Edit novice user.

ASUS Legion Y540-15IRH, Intel Core i7-9750H ,GeForce RTX 2060 6GB, 32 GB RAM, Windows 10 64bit, Logitech Brio webcam + CAMO (Huawei P30 Pro)

Audient id44 audio interface + Aston Origin (vocal mic) + Aston Starlight (stereo paired piano mics)

Or

Yeti Pro

VEGAS Pro 20 Edit + SoundForge Pro 14 Microsoft Store Edition + Acon Acoustica 7.4 Premium Edition

Also using Reaper and OBS frequently, VideoRedo TV Suite 6, now also HandBrake, thanks for the tip!

Audio plugins by Acon, iZotope, Waves, etc.