### Lua Usage Example for Library Operations Source: https://github.com/nvgpartners/nonsensicalvideogenerator/wiki/Lua-Documentation This example demonstrates how to check if a file exists in the library, download a YouTube video as an MP3, and add it to the library. It also shows how to download a WAV file from a URL and add it to the library. ```lua if not functions.libraryHasFile("audio", "music", "rickastley_nevergonnagiveyouup.mp3") then functions.executeProgram("yt-dlp", "https://www.youtube.com/watch?v=dQw4w9WgXcQ --extract-audio --audio-format mp3 --audio-quality 0 --output \"rickastley_nevergonnagiveyouup.%(ext)s\"") functions.addToLibrary("audio", "music", "rickastley_nevergonnagiveyouup.mp3") end if not functions.libraryHasFile("audio", "sfx", "sample-3s.wav") then functions.downloadFile("https://download.samplelib.com/wav/sample-3s.wav", "audio", "sfx") end ``` -------------------------------- ### Example Metadata Section Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/localization-system.md The Metadata section includes configuration for the language name and font families, as well as a boolean to determine the default placement of outro text. ```json "Metadata": { "LocalizedName": "English", "FontLarge": "Munro", "FontSmall": "MunroSmall", "PreferDefaultOutroTextBelow": false } ``` -------------------------------- ### Parameter Substitution Example Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/localization-system.md Strings can include placeholders like %1, %2, etc., which are dynamically replaced with provided values during runtime. This allows for dynamic content within localized strings. ```json "Generate:StatusClipStart": "Starting clip %1/%2..." ``` -------------------------------- ### Install Pillow and NumPy Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/configuration.md Install both Pillow for image operations and NumPy, which is an optional dependency for the gradient generation script. This command installs the latest compatible versions. ```bash pip install Pillow numpy ``` -------------------------------- ### StartGeneration Source: https://github.com/nvgpartners/nonsensicalvideogenerator/wiki/Lua-Documentation This function is called when the effect is started. It receives options, plugin settings, and global functions to begin the generation process. ```APIDOC ## StartGeneration ### Description This function is called when the effect is started. It receives options, plugin settings, and global functions to begin the generation process. ### Parameters #### Path Parameters - `options` (table) - The options table passed to the effect. See [options](#options). - `pluginSettings` (table) - The plugin settings table passed to the effect. See [pluginSettings](#pluginSettings). - `functions` (table) - The global functions table. See [functions](#functions). ### Return Value - `boolean` ``` -------------------------------- ### Create Image Patterns from Gradients Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/branding-system.md Combine multiple generated gradients to create larger, complex patterns. This example generates a quarter gradient and then tiles it to form a full pattern. ```python from PIL import Image from branding.gradient import generate_gradient # Generate base gradients generate_gradient(200, 200, (198, 252, 187), (247, 243, 157), (180, 178, 255), (231, 163, 232), 'quarter.png') # Combine into larger pattern quarter = Image.open('quarter.png') full = Image.new('RGB', (400, 400)) full.paste(quarter, (0, 0)) full.paste(quarter, (200, 0)) full.paste(quarter, (0, 200)) full.paste(quarter, (200, 200)) full.save('pattern.png') ``` -------------------------------- ### Install Pillow for Image Operations Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/configuration.md Install the Pillow library, which is required for image manipulation in the gradient generation script. This command installs Pillow version 8.0.0 or later. ```bash pip install Pillow ``` -------------------------------- ### Reference Localization Tokens Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/localization-tokens-index.md Shows the format for referencing localization tokens in code or documentation, including examples with and without parameters. ```plaintext Category:TokenName Example: Generate:StatusCompleted Maps to: "Completed!" With parameters: Generate:StatusClipStart with params [5, 10] Maps to: "Starting clip 5/10..." ``` -------------------------------- ### Generate Diagonal Gradient Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/branding-system.md Produces a gradient with colors transitioning diagonally. This example uses mint and orchid for opposite corners. ```python generate_gradient( 400, 400, (198, 252, 187), # Mint (231, 163, 232), # Orchid (diagonal opposite) (231, 163, 232), # Orchid (198, 252, 187), # Mint 'diagonal.png' ) ``` -------------------------------- ### Get Localization String Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/DOCUMENTATION_SUMMARY.md Retrieves a localized string based on a token. This is used for internationalization. ```python GetString("Generate:StatusCompleted") ``` -------------------------------- ### Get Addon Library Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/DOCUMENTATION_SUMMARY.md Retrieves an addon library by its name. This is useful for integrating external functionalities. ```python library = context.get_library("remix") ``` -------------------------------- ### Generate Custom Color Gradients Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/branding-system.md Use the `generate_gradient` function to create custom color palettes for branding assets. This example shows how to define a warmer color scheme. ```python from branding.gradient import generate_gradient # Create a warmer variant warm_gradient = ( (255, 200, 150), # Warm mint (255, 230, 120), # Warm yellow (200, 150, 255), # Warm purple (255, 150, 200) # Warm pink ) generate_gradient(400, 400, *warm_gradient, 'warm_variant.png') ``` -------------------------------- ### Access Library Media in Addon Init Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/addon-libraries.md Demonstrates how to access a specific library's media within your addon's initialization function using the context object. Ensure the library is declared in `requires_libraries`. ```lua return { name = "MyRemixAddon", requires_libraries = {"remix"}, init = function(context) -- Access remix.mp3 via the context local remix_audio = context.get_library("remix") end } ``` -------------------------------- ### Configuration Keys Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/INDEX.md Lists the available configuration parameters for the system. ```text width, height, color_tl, color_tr, color_bl, color_br, output_file ``` -------------------------------- ### Execute Gradient Generation Script Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/configuration.md Run the gradient generation script using default parameters. This will create a 'gradient.png' file in the current directory. ```bash python branding/gradient.py ``` -------------------------------- ### Addon Resources Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/INDEX.md Lists the available addon resources, including effects. ```text Remix Effect, Distort Effect, Boom Effect, Sad Effect, Fearful Effect, Video Webcam Effect, HyCam2 Effect, Repeat Explosion Effect ``` -------------------------------- ### Deployment Automation Script Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/branding-system.md A bash script to automate the generation of branding assets for deployment. It first generates a default gradient and then uses an inline Python script to create additional sizes. ```bash #!/bin/bash # Generate all required branding assets cd branding/ python gradient.py # Generate default 400x400 gradient # Generate additional sizes for deployment python -c " from gradient import generate_gradient colors = ((198, 252, 187), (247, 243, 157), (180, 178, 255), (231, 163, 232)) assets = [ (1920, 1080, '../assets/gradient_1080p.png'), (3840, 2160, '../assets/gradient_4k.png'), ] for w, h, f in assets: generate_gradient(w, h, *colors, f) " ``` -------------------------------- ### Reference Library in Addon Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/addon-libraries.md Use this to specify a media library for your addon. The library name corresponds to a subdirectory within the addon libraries. ```lua local myEffectOptions = { library = "fear", -- Uses the fearful effect video library -- ... other options } ``` -------------------------------- ### Define Media Libraries in Query() Source: https://github.com/nvgpartners/nonsensicalvideogenerator/wiki/Lua-Documentation Define media libraries within the Query() function using the 'libraries' table to allow users to import media. Specify the library's name, tooltip, internal path, and media type (video or audio). ```lua ["libraries"] = { { ["name"] = "Example", ["tooltip"] = "Example video clips", ["path"] = "example", ["type"] = "video" } ``` -------------------------------- ### Global Options Source: https://github.com/nvgpartners/nonsensicalvideogenerator/wiki/Lua-Documentation Contains global options that can be passed to the video generator functions. ```APIDOC ## Parameters: options ### Description Contains global options for the video generator. ### Fields - **width** (number) - The width of the image. - **height** (number) - The height of the image. - **inputVideo** (string) - The path to the input video. - **outputVideo** (string) - The path to the output video. - **localeName** (string) - The current locale name. See [Localization](Localization). - **localizationTokens** (table) - The localization tokens for the current locale. See [Localization](Localization). ``` -------------------------------- ### Reset Save Data Files Source: https://github.com/nvgpartners/nonsensicalvideogenerator/wiki/Resetting-NVG Delete specific files and folders within the NVG installation directory to reset all user data. This includes configuration files, plugins, and media libraries. ```plaintext frei0r-1/ library/ plugins/ temp/ DisabledMedia.json Options.json PluginSettings.json UserConsent.json ffmpeg.exe ffprobe.exe ``` -------------------------------- ### Recommended Type Hints for Gradient Generation Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/types.md Provides recommended type annotations for the `generate_gradient` function, enhancing code readability and maintainability. Requires importing `Tuple` from the `typing` module. ```python from typing import Tuple def generate_gradient( width: int, height: int, color_tl: Tuple[int, int, int], color_tr: Tuple[int, int, int], color_bl: Tuple[int, int, int], color_br: Tuple[int, int, int], output_file: str ) -> None: ... ``` -------------------------------- ### Addon Option Descriptions Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/localization-system.md Localizes descriptions for stock addon options. Use these to explain the functionality of different addon settings. ```json "Addons:StockDanceOption2": "Repeating forward-reverse with music." "Addons:StockDanceOption3": "Out of 100, where the video will have no music." ``` -------------------------------- ### Python Utilities for Branding and Asset Generation Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/PROJECT_OVERVIEW.md This repository includes Python utilities for tasks such as branding and asset generation. The actual game engine and video generation system are maintained in a separate repository. ```bash ├── locales/ # Localization JSON files (English, French, German, Hungarian, Russian, Slovak) ├── branding/ # Brand assets and Python utilities for gradient generation ├── addonlibraries/ # Media resources (MP4, MP3) for addon creators ├── defaultoutro/ # Default video outro content ├── soundtrack/ # Soundtrack assets ├── steamlocales/ # Steam-specific localization files └── README.md # Project overview and links ``` -------------------------------- ### Query Source: https://github.com/nvgpartners/nonsensicalvideogenerator/wiki/Lua-Documentation This function is called when the effect is first loaded. It is used to initialize the effect with localization data. ```APIDOC ## Query ### Description This function is called when the effect is first loaded. It is used to initialize the effect with localization data. ### Parameters #### Path Parameters - `localeName` (string) - The current locale name. See [Localization](Localization). - `localizationTokens` (table) - The localization tokens for the current locale. See [Localization](Localization). ### Return Value - `table` ``` -------------------------------- ### Recommended Type Hints for Color Interpolation Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/types.md Provides recommended type annotations for the `interpolate_color` function, improving code clarity and IDE support. Requires importing `Tuple` from the `typing` module. ```python from typing import Tuple def interpolate_color( color1: Tuple[int, int, int], color2: Tuple[int, int, int], ratio: float ) -> Tuple[int, int, int]: ... ``` -------------------------------- ### Run Sequential FFmpeg Commands in Lua Source: https://github.com/nvgpartners/nonsensicalvideogenerator/wiki/Lua-Documentation Use the PostCommand function to execute FFmpeg commands sequentially. The commandIndex parameter is crucial for managing the order of operations and ensuring subsequent commands receive the correct input files. ```lua if commandindex == 1 then functions.runFFmpeg("-i \"" .. temp .. "\" -vf negate -preset veryfast -y \"" .. temp2 .. "\"") elseif commandindex == 2 then functions.runFFmpeg("-i \"" .. temp2 .. "\" -vf hue=s=0 -preset veryfast -y \"" .. options.outputVideo .. "\"") end ``` -------------------------------- ### Addon Integration Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/DOCUMENTATION_SUMMARY.md Retrieves a library for addon integration. ```APIDOC ## context.get_library() ### Description Retrieves a specified library for addon integration. ### Parameters - **library_name** (string) - Required - The name of the library to retrieve. ### Returns - **library_object** - An object representing the requested library. ### Request Example ```python library = context.get_library("remix") ``` ``` -------------------------------- ### Localization File Format Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/localization-system.md Each localization file is a valid JSON object containing a 'Metadata' section for language configuration and a 'Version0' section for localized strings. ```json { "Metadata": { ... }, "Version0": { ... } } ``` -------------------------------- ### File Path String Definition Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/types.md Represents a filesystem path as a string. Used to specify the output location for generated files. ```python str ``` -------------------------------- ### Tooltip and Help Text Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/localization-system.md Localizes tooltips and help text for interactive UI elements. These provide contextual information to the user. ```json "Interactable:EffectChanceTooltip": "How often any effect are used, from 0-100." "Interactable:FPSTooltip": "How smooth the result is.\nTypical video FPS values are as follows:\n..." ``` -------------------------------- ### Web Background CSS Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/branding-system.md Use this CSS to set a gradient background for web pages. Ensure 'nvg_gradient.png' is in the correct path. ```html ``` -------------------------------- ### PostCommand Source: https://github.com/nvgpartners/nonsensicalvideogenerator/wiki/Lua-Documentation This function is called after each asynchronous command is run, typically for command-line programs like FFmpeg or ImageMagick. It allows for sequential command processing. ```APIDOC ## PostCommand ### Description This function is called after each asynchronous command is run, typically for command-line programs like FFmpeg or ImageMagick. It allows for sequential command processing. ### Parameters #### Path Parameters - `commandIndex` (number) - The index of the command that was run. - `outputResult` (string) - The output of the command. - `errorResult` (string) - The error output of the command. - `options` (table) - The options table passed to the effect. See [options](#options). - `pluginSettings` (table) - The plugin settings table passed to the effect. See [pluginSettings](#pluginSettings). - `functions` (table) - The global functions table. See [functions](#functions). ### Return Value - `nil` ### Request Example ```lua if commandindex == 1 then functions.runFFmpeg("-i \" .. temp .. \" -vf negate -preset veryfast -y \" .. temp2 .. \"") elseif commandindex == 2 then functions.runFFmpeg("-i \" .. temp2 .. \" -vf hue=s=0 -preset veryfast -y \" .. options.outputVideo .. \"") end ``` ``` -------------------------------- ### Plugin Settings Source: https://github.com/nvgpartners/nonsensicalvideogenerator/wiki/Lua-Documentation User-configurable settings for plugins, keyed by name. ```APIDOC ## Parameters: pluginSettings ### Description This table contains user-configurable settings for the plugin. All settings are keyed by their name with their value returned as a `string`. See: [Querying](#querying-and-libraries) ``` -------------------------------- ### Define Custom Settings in Query() Source: https://github.com/nvgpartners/nonsensicalvideogenerator/wiki/Lua-Documentation Use the 'settings' table within the Query() function to define custom user-configurable options for your effect. Supported types include 'label', 'bool', and others. ```lua ["settings"] = { { ["name"] = "Display Name", ["value"] = "Example", ["type"] = "label" }, { ["name"] = "Description", ["value"] = "An example effect.", ["type"] = "label" }, { ["name"] = "Test Setting", ["tooltip"] = "A test toggle switch.", ["value"] = "0", ["type"] = "bool" } } ``` -------------------------------- ### Generate Official Brand Gradient Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/branding-system.md Creates a standard gradient using the official brand colors. Specify dimensions, four RGB color tuples, and the output filename. ```python generate_gradient( 400, 400, (198, 252, 187), # Mint (247, 243, 157), # Yellow (180, 178, 255), # Periwinkle (231, 163, 232), # Orchid 'official.png' ) ``` -------------------------------- ### Access Library Files in Lua Source: https://github.com/nvgpartners/nonsensicalvideogenerator/wiki/Lua-Documentation Access media files from defined libraries using the 'functions.getRandomLibraryFile()' function. This returns a placeholder that is internally resolved to the correct file path when used in commands. ```lua local music = functions.getRandomLibraryFile("audio", "music") ``` -------------------------------- ### Documented Functions Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/INDEX.md Lists the functions that have documented API references. ```python branding.gradient.interpolate_color() branding.gradient.generate_gradient() ``` -------------------------------- ### Batch Gradient Generation Script Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/branding-system.md Automates the creation of multiple gradient variations with predefined sizes and colors. Imports 'generate_gradient' from 'branding.gradient'. ```python from branding.gradient import generate_gradient sizes = [ (400, 400, 'square'), (1920, 1080, 'widescreen'), (1920, 622, 'steam_banner'), (1024, 576, 'discord') ] base_colors = ( (198, 252, 187), (247, 243, 157), (180, 178, 255), (231, 163, 232) ) for width, height, name in sizes: filename = f'gradient_{name}_{width}x{height}.png' generate_gradient(width, height, *base_colors, filename) print(f'Generated {filename}') ``` -------------------------------- ### Generate Bilinear Gradient Image Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/api-reference-gradient.md Creates a gradient image by interpolating colors from four corner points using a bilinear approach. Save the generated image to a specified file path. Requires Pillow library. ```python from branding.gradient import generate_gradient # Create a 400x400 gradient with Nonsensical Video Generator branding colors generate_gradient( width=400, height=400, color_tl=(198, 252, 187), # Top-left: light green (#C6FCBB) color_tr=(247, 243, 157), # Top-right: light yellow (#F7F39D) color_bl=(180, 178, 255), # Bottom-left: light blue (#B4B2FF) color_br=(231, 163, 232), # Bottom-right: light magenta (#E7A3E8) output_file='gradient.png' ) ``` -------------------------------- ### Localization Directory Structure Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/localization-system.md The localization files are organized in the 'locales/' directory, with each language having its own JSON file. English is used as the base language reference. ```tree locales/ ├── english.json # English (US) - Base language reference ├── french.json # French ├── german.json # German ├── hungarian.json # Hungarian ├── russian.json # Russian └── slovak.json # Slovak ``` -------------------------------- ### Generate Status Messages Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/localization-system.md Provides localized strings for video generation status updates. Use these keys to display progress to the user. ```json "Generate:StatusStarting": "Starting generation..." "Generate:StatusSeed": "Planting seeds..." "Generate:StatusCheckValidity": "Checking for validity... (%1/%2)" "Generate:StatusCompleted": "Completed!" ``` -------------------------------- ### String Key Patterns Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/localization-system.md Localized strings are identified using dot-separated keys. Patterns include simple tokens, multi-line tokens indicated by '_N', and tokens with parameter placeholders. ```plaintext Category:TokenName Category:Token_N Category:Token with %1 ``` -------------------------------- ### Python Gradient Utility Functions Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/_COMPLETION_REPORT.md These are the function signatures for the Python utility used for color interpolation and gradient generation. They are part of the branding system. ```python interpolate_color(color1, color2, ratio) ``` ```python generate_gradient(width, height, color_tl, color_tr, color_bl, color_br, output_file) ``` -------------------------------- ### Generate Gradient Image Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/DOCUMENTATION_SUMMARY.md Generates a gradient image with specified dimensions and corner colors. Saves the output to a PNG file. ```python from branding.gradient import generate_gradient generate_gradient(400, 400, (198, 252, 187), (247, 243, 157), (180, 178, 255), (231, 163, 232), 'gradient.png') ``` -------------------------------- ### Documented Types Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/INDEX.md Lists the types that have documented definitions. ```python RGB Color Tuple → (int, int, int) Float Range → float [0.0..1.0] File Path String → str Dimension Integer → int ``` -------------------------------- ### branding.gradient.generate_gradient Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/README.md Generates a gradient PNG image with specified dimensions and corner colors, saving it to a file. ```APIDOC ## generate_gradient(width, height, color_tl, color_tr, color_bl, color_br, output_file) ### Description Generate 4-corner gradient PNG images. ### Parameters - **width** (int) - Description not available. - **height** (int) - Description not available. - **color_tl** (color) - Top-left corner color. - **color_tr** (color) - Top-right corner color. - **color_bl** (color) - Bottom-left corner color. - **color_br** (color) - Bottom-right corner color. - **output_file** (str) - Path to save the output PNG image. ``` -------------------------------- ### generate_gradient(width, height, color_tl, color_tr, color_bl, color_br, output_file) Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/api-reference-gradient.md Generates a gradient image with color interpolation from four corner points. This function is used to create branding assets with smooth color transitions. ```APIDOC ## Function: generate_gradient(width, height, color_tl, color_tr, color_bl, color_br, output_file) ### Description Creates a rectangular gradient image with smooth color transitions from the four corners. For each pixel, the color is interpolated by: 1. Horizontally interpolating the top and bottom edge colors 2. Vertically interpolating the left and right results This produces a smooth bilinear gradient across the entire image. ### Signature ```python def generate_gradient(width, height, color_tl, color_tr, color_bl, color_br, output_file): ``` ### Parameters #### Path Parameters - **width** (int) - Required - Output image width in pixels - **height** (int) - Required - Output image height in pixels - **color_tl** (tuple[int, int, int]) - Required - Top-left corner RGB color (0-255 per component) - **color_tr** (tuple[int, int, int]) - Required - Top-right corner RGB color (0-255 per component) - **color_bl** (tuple[int, int, int]) - Required - Bottom-left corner RGB color (0-255 per component) - **color_br** (tuple[int, int, int]) - Required - Bottom-right corner RGB color (0-255 per component) - **output_file** (str) - Required - File path where PNG image will be saved ### Return Type ```python None ``` Creates a PNG file at the specified path. No return value. ### Example ```python from branding.gradient import generate_gradient # Create a 400x400 gradient with Nonsensical Video Generator branding colors generate_gradient( width=400, height=400, color_tl=(198, 252, 187), # Top-left: light green (#C6FCBB) color_tr=(247, 243, 157), # Top-right: light yellow (#F7F39D) color_bl=(180, 178, 255), # Bottom-left: light blue (#B4B2FF) color_br=(231, 163, 232), # Bottom-right: light magenta (#E7A3E8) output_file='gradient.png' ) ``` ### Algorithm Details For each pixel at position (x, y): 1. Calculate horizontal ratio: `ratio_x = x / (width - 1)` 2. Calculate vertical ratio: `ratio_y = y / (height - 1)` 3. Interpolate top edge: `color_top = interpolate_color(color_tl, color_tr, ratio_x)` 4. Interpolate bottom edge: `color_bottom = interpolate_color(color_bl, color_br, ratio_x)` 5. Interpolate vertically: `color = interpolate_color(color_top, color_bottom, ratio_y)` 6. Set pixel to computed color ``` -------------------------------- ### Generate Wide Format Gradient (16:9) Source: https://github.com/nvgpartners/nonsensicalvideogenerator/blob/main/_autodocs/branding-system.md Generates a gradient with a 16:9 aspect ratio, suitable for wide formats like banners. Adjust width and height accordingly. ```python generate_gradient( 1920, 1080, (198, 252, 187), (247, 243, 157), (180, 178, 255), (231, 163, 232), 'wide_gradient.png' ) ```