Need a script for changing media's alpha channel.

iEmby wrote on 10/5/2024, 1:33 AM

hi guys..

can someone help me creating a script which can change the alpha channel to Straight (Unmatted) of the selected event at its media level with one click.

thanks in advance.

 

PROCESSOR
     

Operating System: Windows 11 Pro 64-bit (Always Updated)
System Manufacturer: ASUS
12th Gen Intel(R) Core(TM) i7-12700 (20 CPUs), ~2.1GHz - 4.90GHz
Memory: 32GB RAM
Page File: 11134MB used, 7934MB Available
DirectX Version: DirectX 12

-----------------------------------------------

MOTHERBOARD

 

ASUS PRIME H610-CS D4
Intel® H610 (LGA 1700)
Ready for 12th Gen Intel® Processors
Micro-ATX Motherboard with DDR4
Realtek 1 Gb Ethernet
PCH Heatsink
PCIe 4.0 | M.2 slot (32Gbps) 
HDMI® | D-Sub | USB 3.2 Gen 1 ports
SATA 6 Gbps | COM header
LPT header | TPM header
Luminous Anti-Moisture Coating
5X Protection III
(Multiple Hardware Safeguards
For all-round protection)

-----------------------------------------------
EXTERNAL GRAPHIC CARD

-----------------------------------------------

INTERNAL GRAPHIC CARD (iGPU)

------------------------------------------------

LED - MONITOR

Monitor Name: Generic PnP Monitor
Monitor Model: HP 22es
Monitor Id: HWP331B
Native Mode: 1920 x 1080(p) (60.000Hz)
Output Type: HDMI

-----------------------------------------------

STORAGE DRIVE

Drive: C:
Free Space: 182.3 GB
Total Space: 253.9 GB
File System: NTFS
Model: WD Blue SN570 1TB (NVMe)

---------------O----------------

My System Info (PDF File).

https://drive.google.com/open?id=1-eoLmuXzshTRH_8RunAYAuNocKpiLoiV&usp=drive_fs

 

Also Check

Some useful creations by me including VEGAS Scripts

https://getopensofts.blogspot.com/

 

My YouTube Channel Dedicated to Only VEGAS Pro Tutorials

EDITROOM : My YouTube Channel (For VEGAS Tutorials)

Comments

jetdv wrote on 10/5/2024, 7:41 AM

Just take a look through my tutorials...

iEmby wrote on 10/5/2024, 1:21 PM

Thanks so much sir for giving me Idea....

 

using ScriptPortal.Vegas;

namespace Change_Alpha_To_Straight
{
    public class EntryPoint
    {
        public void FromVegas(Vegas vegas)
        {
            // Loop through each track in the project
            foreach (Track track in vegas.Project.Tracks)
            {
                // Only process video tracks
                if (!(track is VideoTrack)) continue;

                // Loop through each event on the track
                foreach (TrackEvent evnt in track.Events)
                {
                    // Check if the event is a video event
                    if (evnt is VideoEvent)
                    {
                        // Cast the event to a VideoEvent
                        VideoEvent videoEvent = (VideoEvent)evnt;

                        // Get the media from the active take of the video event
                        Media media = videoEvent.ActiveTake.Media;

                        // Ensure the media is valid and has video streams
                        if (media != null && media.HasVideo())
                        {
                            // Loop through media streams
                            foreach (MediaStream stream in media.Streams)
                            {
                                // Check if the stream is a video stream by its MediaType
                                if (stream.MediaType == MediaType.Video)
                                {
                                    VideoStream videoStream = (VideoStream)stream;

                                    // Set the alpha channel to 'Straight'
                                    videoStream.AlphaChannel = VideoAlphaType.Straight;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

 

PROCESSOR
     

Operating System: Windows 11 Pro 64-bit (Always Updated)
System Manufacturer: ASUS
12th Gen Intel(R) Core(TM) i7-12700 (20 CPUs), ~2.1GHz - 4.90GHz
Memory: 32GB RAM
Page File: 11134MB used, 7934MB Available
DirectX Version: DirectX 12

-----------------------------------------------

MOTHERBOARD

 

ASUS PRIME H610-CS D4
Intel® H610 (LGA 1700)
Ready for 12th Gen Intel® Processors
Micro-ATX Motherboard with DDR4
Realtek 1 Gb Ethernet
PCH Heatsink
PCIe 4.0 | M.2 slot (32Gbps) 
HDMI® | D-Sub | USB 3.2 Gen 1 ports
SATA 6 Gbps | COM header
LPT header | TPM header
Luminous Anti-Moisture Coating
5X Protection III
(Multiple Hardware Safeguards
For all-round protection)

-----------------------------------------------
EXTERNAL GRAPHIC CARD

-----------------------------------------------

INTERNAL GRAPHIC CARD (iGPU)

------------------------------------------------

LED - MONITOR

Monitor Name: Generic PnP Monitor
Monitor Model: HP 22es
Monitor Id: HWP331B
Native Mode: 1920 x 1080(p) (60.000Hz)
Output Type: HDMI

-----------------------------------------------

STORAGE DRIVE

Drive: C:
Free Space: 182.3 GB
Total Space: 253.9 GB
File System: NTFS
Model: WD Blue SN570 1TB (NVMe)

---------------O----------------

My System Info (PDF File).

https://drive.google.com/open?id=1-eoLmuXzshTRH_8RunAYAuNocKpiLoiV&usp=drive_fs

 

Also Check

Some useful creations by me including VEGAS Scripts

https://getopensofts.blogspot.com/

 

My YouTube Channel Dedicated to Only VEGAS Pro Tutorials

EDITROOM : My YouTube Channel (For VEGAS Tutorials)

iEmby wrote on 10/5/2024, 1:52 PM

@jetdv
sir please help in one small thing....

how can I change this icon.

I tried all giving Png or set icon icons.

but it is not set.

PROCESSOR
     

Operating System: Windows 11 Pro 64-bit (Always Updated)
System Manufacturer: ASUS
12th Gen Intel(R) Core(TM) i7-12700 (20 CPUs), ~2.1GHz - 4.90GHz
Memory: 32GB RAM
Page File: 11134MB used, 7934MB Available
DirectX Version: DirectX 12

-----------------------------------------------

MOTHERBOARD

 

ASUS PRIME H610-CS D4
Intel® H610 (LGA 1700)
Ready for 12th Gen Intel® Processors
Micro-ATX Motherboard with DDR4
Realtek 1 Gb Ethernet
PCH Heatsink
PCIe 4.0 | M.2 slot (32Gbps) 
HDMI® | D-Sub | USB 3.2 Gen 1 ports
SATA 6 Gbps | COM header
LPT header | TPM header
Luminous Anti-Moisture Coating
5X Protection III
(Multiple Hardware Safeguards
For all-round protection)

-----------------------------------------------
EXTERNAL GRAPHIC CARD

-----------------------------------------------

INTERNAL GRAPHIC CARD (iGPU)

------------------------------------------------

LED - MONITOR

Monitor Name: Generic PnP Monitor
Monitor Model: HP 22es
Monitor Id: HWP331B
Native Mode: 1920 x 1080(p) (60.000Hz)
Output Type: HDMI

-----------------------------------------------

STORAGE DRIVE

Drive: C:
Free Space: 182.3 GB
Total Space: 253.9 GB
File System: NTFS
Model: WD Blue SN570 1TB (NVMe)

---------------O----------------

My System Info (PDF File).

https://drive.google.com/open?id=1-eoLmuXzshTRH_8RunAYAuNocKpiLoiV&usp=drive_fs

 

Also Check

Some useful creations by me including VEGAS Scripts

https://getopensofts.blogspot.com/

 

My YouTube Channel Dedicated to Only VEGAS Pro Tutorials

EDITROOM : My YouTube Channel (For VEGAS Tutorials)

Steve_Rhoden wrote on 10/6/2024, 6:04 AM

@iEmby Best you try configure that script to toggle between Straight and Premultiplied, because some media content with an alpha channel shows cleaner with Premultiplied.

jetdv wrote on 10/6/2024, 7:34 AM

@iEmby, in this section:

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

        CCM.MenuItemName = "My Test Custom Command";
    }

Add the IconFile to use:

    public void InitializeModule(Vegas vegas)
    {
        myVegas = vegas;
        CCM.MenuItemName = "My Test Custom Command";
        CCM.IconFile = "{path to my icon}";
    }

However, I'm not seeing any icons at all in VEGAS Pro 22.

john_dennis wrote on 10/6/2024, 8:59 AM

@jetdv I'm seeing icons with graphics that I created or installed years ago, but I'm having poor results with adding new graphics in Vegas Pro 22-122.

jetdv wrote on 10/6/2024, 9:01 AM

@john_dennis I'm talking about extensions, not scripts.

jetdv wrote on 10/6/2024, 1:10 PM

@john_dennis, I'm not seeing them for scripts either, though:

jetdv wrote on 10/6/2024, 1:20 PM

@john_dennis, I'm seeing them again after a reboot...

john_dennis wrote on 10/6/2024, 1:48 PM

@jetdv I've analyzed this six ways to Sunday and now I'm more confused than I was at the beginning. The most reliable solution that I've found was opening the .png files in Classic Paint (Windows 11) and saving. This seems to work without regard to how I might have created the files.

General
Complete name                            : C:\Users\jaden\OneDrive\Documents\Vegas Script Menu\JAD Logo 16x16 copy.png
Format                                   : PNG
Format/Info                              : Portable Network Graphic
File size                                : 4.90 KiB

Image
Format                                   : PNG
Format/Info                              : Portable Network Graphic
Compression                              : Deflate
Format settings                          : Linear
Width                                    : 16 pixels
Height                                   : 16 pixels
Display aspect ratio                     : 1.000
Color space                              : RGB
Bit depth                                : 8 bits
Compression mode                         : Lossless
Stream size                              : 4.90 KiB (100%)
Color range                              : Full
Color primaries                          : BT.709
Transfer characteristics                 : sRGB/sYCC
Matrix coefficients                      : Identity
Gamma                                    : 0.455
ColorSpace_ICC                           : RGB

General
Complete name                            : C:\Users\jaden\OneDrive\Documents\Vegas Script Menu\JAD Logo 16x16 one transparent pixel.png
Format                                   : PNG
Format/Info                              : Portable Network Graphic
File size                                : 5.01 KiB

Image
Format                                   : PNG
Format/Info                              : Portable Network Graphic
Compression                              : Deflate
Format settings                          : Linear
Width                                    : 16 pixels
Height                                   : 16 pixels
Display aspect ratio                     : 1.000
Color space                              : RGBA
Bit depth                                : 8 bits
Compression mode                         : Lossless
Stream size                              : 5.01 KiB (100%)
Color range                              : Full
Color primaries                          : BT.709
Transfer characteristics                 : sRGB/sYCC
Matrix coefficients                      : Identity
Gamma                                    : 0.455

General
Complete name                            : C:\Users\jaden\OneDrive\Documents\Vegas Script Menu\JAD Logo 16x16 Opened and Saved in Paint.png
Format                                   : PNG
Format/Info                              : Portable Network Graphic
File size                                : 5.04 KiB

Image
Format                                   : PNG
Format/Info                              : Portable Network Graphic
Compression                              : Deflate
Format settings                          : Linear
Width                                    : 16 pixels
Height                                   : 16 pixels
Display aspect ratio                     : 1.000
Color space                              : RGBA
Bit depth                                : 8 bits
Compression mode                         : Lossless
Stream size                              : 5.04 KiB (100%)
Color range                              : Full
Color primaries                          : BT.709
Transfer characteristics                 : sRGB/sYCC
Matrix coefficients                      : Identity
Gamma                                    : 0.455

 

jetdv wrote on 10/7/2024, 8:32 AM

@john_dennis the important line here is Color Space: RGBA

The images MUST have "transparency" to show. Often, I make my icons and then just make one pixel transparent to make sure it saves as RGBA out of the photo editor.

john_dennis wrote on 10/7/2024, 9:53 AM

@jetdv That appears to be correct.

An Aside

It appears that Classic Paint in Windows 11 adds the Color Space parameter where none existed before:

That's probably why it always seemed to fix the problem.

jetdv wrote on 10/7/2024, 9:59 AM

@john_dennis your left image is a JPG. JPG doesn't support transparency which is why they need to be PNG files.

john_dennis wrote on 10/7/2024, 10:12 AM

I understand. I made the PNG from the JPG in Classic Paint and the Color Space was changed to show RGBA where no actual transparency existed. The implication to me is that transparency doesn't have to be present, it just has to be possible based on the file parameters.

Sorry for semantisizing.

iEmby wrote on 10/7/2024, 10:15 AM

I'm seeing icons with graphics that I created or installed years ago, but I'm having poor results with adding new graphics in Vegas Pro 22-122.

sir.. in the cases of scripts .. my icons are so smooth and perfect.

PROCESSOR
     

Operating System: Windows 11 Pro 64-bit (Always Updated)
System Manufacturer: ASUS
12th Gen Intel(R) Core(TM) i7-12700 (20 CPUs), ~2.1GHz - 4.90GHz
Memory: 32GB RAM
Page File: 11134MB used, 7934MB Available
DirectX Version: DirectX 12

-----------------------------------------------

MOTHERBOARD

 

ASUS PRIME H610-CS D4
Intel® H610 (LGA 1700)
Ready for 12th Gen Intel® Processors
Micro-ATX Motherboard with DDR4
Realtek 1 Gb Ethernet
PCH Heatsink
PCIe 4.0 | M.2 slot (32Gbps) 
HDMI® | D-Sub | USB 3.2 Gen 1 ports
SATA 6 Gbps | COM header
LPT header | TPM header
Luminous Anti-Moisture Coating
5X Protection III
(Multiple Hardware Safeguards
For all-round protection)

-----------------------------------------------
EXTERNAL GRAPHIC CARD

-----------------------------------------------

INTERNAL GRAPHIC CARD (iGPU)

------------------------------------------------

LED - MONITOR

Monitor Name: Generic PnP Monitor
Monitor Model: HP 22es
Monitor Id: HWP331B
Native Mode: 1920 x 1080(p) (60.000Hz)
Output Type: HDMI

-----------------------------------------------

STORAGE DRIVE

Drive: C:
Free Space: 182.3 GB
Total Space: 253.9 GB
File System: NTFS
Model: WD Blue SN570 1TB (NVMe)

---------------O----------------

My System Info (PDF File).

https://drive.google.com/open?id=1-eoLmuXzshTRH_8RunAYAuNocKpiLoiV&usp=drive_fs

 

Also Check

Some useful creations by me including VEGAS Scripts

https://getopensofts.blogspot.com/

 

My YouTube Channel Dedicated to Only VEGAS Pro Tutorials

EDITROOM : My YouTube Channel (For VEGAS Tutorials)

john_dennis wrote on 10/7/2024, 10:17 AM

@iEmby Congratulations!

john_dennis wrote on 10/8/2024, 9:18 AM

@iEmby @jetdv

I'm currently running a Vegas 22 trial on top of an out of the box Windows 11 image which I dual boot to an in-place Windows 11 upgrade of my Vegas 21 image. I'm exploring changes that I would normally ignore in favor of getting things done. This article gave me comfort that I had not lost my mind completely.

Paint in Windows 11 Is Adding Layers and Transparency