### Serve Documentation Locally Source: https://github.com/gillesvink/opendefocus/blob/main/docs/src/developer/xtask.md Starts a local server to preview the project documentation. Useful for verifying changes to documentation files. ```bash cargo xtask --serve-docs ``` -------------------------------- ### Build Project with Xtask Source: https://github.com/gillesvink/opendefocus/blob/main/CONTRIBUTING.md Example command to build the project for Nuke using the xtask automation tool. This command specifies the Nuke version, target platform, and build configuration. ```bash cargo xtask --compile --nuke-versions 15.0 --target-platform linux --use-zig --output-to-package ``` -------------------------------- ### Perform simple image convolution with OpenDefocus Source: https://github.com/gillesvink/opendefocus/blob/main/crates/opendefocus/README.md This example demonstrates how to initialize the OpenDefocus renderer, configure defocus settings, and apply a convolution filter to an image. It uses the Rust crate to process an RGBA image and save the resulting output. ```rust use anyhow::Result; use image::{DynamicImage, Rgba32FImage}; use image_ndarray::prelude::ImageArray; use opendefocus::OpenDefocusRenderer; use opendefocus::datamodel::Settings; #[tokio::main] async fn main() -> Result<()> { let mut settings = Settings::default(); settings.defocus.circle_of_confusion.size = 25.0; let renderer = OpenDefocusRenderer::new(true, &mut settings).await?; let image = image::load_from_memory(include_bytes!("../../examples/simple/toad.png"))?.to_rgba32f(); let mut array = image.to_ndarray(); renderer .render(settings, array.view_mut(), None, None) .await?; let image: Rgba32FImage = Rgba32FImage::from_ndarray(array)?; let image = DynamicImage::from(image).to_rgba8(); image.save("./result.png")?; Ok(()) } ``` -------------------------------- ### Simple Convolution Rendering with OpenDefocus (Rust) Source: https://github.com/gillesvink/opendefocus/blob/main/README.md This example demonstrates how to perform a simple convolution rendering using the OpenDefocus library in Rust. It initializes the renderer with custom settings, loads an image, applies the rendering process, and saves the output. Dependencies include 'anyhow', 'image', 'image_ndarray', and 'opendefocus'. The input is an image file and settings, and the output is a processed PNG image. ```rust use anyhow::Result; use image::{DynamicImage, Rgba32FImage}; use image_ndarray::prelude::ImageArray; use opendefocus::OpenDefocusRenderer; use opendefocus::datamodel::Settings; #[tokio::main] async fn main() -> Result<()> { let mut settings = Settings::default(); // set the defocus size in pixel radius, you can change whatever you want settings.defocus.circle_of_confusion.size = 25.0; // initialize a new renderer, this contains the runner instance (wgpu for example) // its fine to throw away if you only use one image, else its good to reuse to prevent initializing all the time let renderer = OpenDefocusRenderer::new(true, &mut settings).await?; // load an example image let image = image::load_from_memory(include_bytes!("../../examples/simple/toad.png"))?.to_rgba32f(); let mut array = image.to_ndarray(); // then here we actually render renderer .render(settings, array.view_mut(), None, None) .await?; // just some loading to the image crate once again after rendering and storing it let image: Rgba32FImage = Rgba32FImage::from_ndarray(array)?; let image = DynamicImage::from(image).to_rgba8(); image.save("./result.png")?; Ok(()) } ``` -------------------------------- ### GET /render/stripe Source: https://context7.com/gillesvink/opendefocus/llms.txt Performs a partial or stripe-based render for interactive processing in GUI applications. ```APIDOC ## GET /render/stripe ### Description Executes a render operation on a specific stripe of the image, optimized for interactive performance and non-blocking UI updates. ### Method GET ### Endpoint /render/stripe ### Parameters #### Query Parameters - **y_start** (integer) - Required - Starting pixel row. - **height** (integer) - Required - Number of rows to process. ### Request Example GET /render/stripe?y_start=0&height=100 ### Response #### Success Response (200) - **stripe_data** (binary) - The rendered image stripe. #### Response Example { "stripe_data": "binary_blob" } ``` -------------------------------- ### Add OpenDefocus Plugin Path to init.py Source: https://github.com/gillesvink/opendefocus/blob/main/docs/src/installation.md This Python code snippet adds the OpenDefocus plugin directory to Nuke's plugin path. It's used within the init.py file to make the plugin available in Nuke. Ensure the path is correct for your installation. ```python nuke.pluginAddPath("./opendefocus_plugin") ``` ```python nuke.pluginAddPath("the/path/to/the/installation/here") ``` -------------------------------- ### Render Image Stripe Source: https://context7.com/gillesvink/opendefocus/llms.txt Provides an example of rendering a specific portion of an image, which is useful for tiled rendering or interactive viewers. It requires defining full and render regions via RenderSpecs. ```rust use ndarray::{Array3, s}; use opendefocus::{ OpenDefocusRenderer, datamodel::render::RenderSpecs, datamodel::{IVector4, Settings, UVector2}, }; #[tokio::main] async fn main() -> anyhow::Result<()> { let mut image: Array3 = Array3::zeros((256, 256, 4)); let mut settings = Settings::default(); settings.render.resolution = UVector2 { x: 256, y: 256 }; // Define full stripe region (x, y, width, height) let full_region = IVector4 { x: 0, y: 0, z: 256, w: 256 }; // Define render region with padding (skip 10 pixels on each edge) let render_region = IVector4 { x: 10, y: 10, z: 246, w: 246 }; let render_specs = RenderSpecs { full_region, render_region }; let renderer = OpenDefocusRenderer::new(true, &mut settings).await?; renderer .render_stripe(render_specs, settings, image.view_mut(), None, None) .await?; Ok(()) } ``` -------------------------------- ### Initialize OpenDefocus Renderer Source: https://context7.com/gillesvink/opendefocus/llms.txt Demonstrates how to instantiate the OpenDefocusRenderer with specific settings. It shows how to select between GPU and CPU backends and verify the active device. ```rust use opendefocus::OpenDefocusRenderer; use opendefocus::datamodel::Settings; #[tokio::main] async fn main() -> anyhow::Result<()> { let mut settings = Settings::default(); // Create renderer preferring GPU (true) or CPU (false) let renderer = OpenDefocusRenderer::new(true, &mut settings).await?; // Check if GPU rendering is active if renderer.is_gpu() { println!("Using GPU: {}", settings.render.device_name.unwrap_or_default()); } else { println!("Falling back to CPU rendering"); } Ok(()) } ``` -------------------------------- ### Clone and Initialize Repository Source: https://github.com/gillesvink/opendefocus/blob/main/CONTRIBUTING.md Commands to clone the OpenDefocus repository from Codeberg and navigate into the project directory. This is the first step for setting up a local development environment. ```bash git clone ssh://git@codeberg.org/YOUR_USERNAME/opendefocus.git cd opendefocus/ ``` -------------------------------- ### Run Project Tests Source: https://github.com/gillesvink/opendefocus/blob/main/docs/src/developer/xtask.md Executes the test suite for the project. Supports both crate-level Rust tests and Python-based integration tests. ```bash cargo xtask --test-crates cargo xtask --pytest ``` -------------------------------- ### Compile Project with Xtask Source: https://github.com/gillesvink/opendefocus/blob/main/docs/src/developer/xtask.md Compiles the project using specified versioning, target platform, and cross-compilation tools. This command ensures consistent builds across different environments. ```bash cargo xtask --compile --nuke-versions 15.0 --target-platform linux --use-zig ``` -------------------------------- ### OpenDefocusRenderer::new Source: https://context7.com/gillesvink/opendefocus/llms.txt Creates a new OpenDefocus renderer instance, allowing selection between GPU and CPU backends. The renderer is designed to be reused to minimize initialization overhead. ```APIDOC ## OpenDefocusRenderer::new ### Description Creates a new OpenDefocus renderer instance with GPU or CPU backend selection. The renderer stores the device configuration and can be reused across multiple renders to avoid repeated initialization overhead. ### Method `OpenDefocusRenderer::new` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```rust use opendefocus::OpenDefocusRenderer; use opendefocus::datamodel::Settings; #[tokio::main] async fn main() -> anyhow::Result<()> { let mut settings = Settings::default(); // Create renderer preferring GPU (true) or CPU (false) let renderer = OpenDefocusRenderer::new(true, &mut settings).await?; // Check if GPU rendering is active if renderer.is_gpu() { println!("Using GPU: {}", settings.render.device_name.unwrap_or_default()); } else { println!("Falling back to CPU rendering"); } Ok(()) } ``` ### Response #### Success Response (200) - **renderer** (OpenDefocusRenderer) - An initialized renderer instance. - **settings** (Settings) - Updated settings object, potentially with device information. #### Response Example (No direct JSON response, returns a Rust struct instance) ``` -------------------------------- ### Compile Nuke Plugin via CLI Source: https://context7.com/gillesvink/opendefocus/llms.txt Uses the xtask build system to compile the native OpenDefocus Nuke plugin for different platforms and versions. ```bash # Compile for specific Nuke versions (Linux) cargo xtask \ --compile \ --nuke-versions 15.1,15.2 \ --target-platform linux \ --output-to-package # Compile for macOS cargo xtask \ --compile \ --nuke-versions 16.0 \ --target-platform macos \ --output-to-package # Add to Nuke path export NUKE_PATH=$(pwd)/package ``` -------------------------------- ### Compile Nuke Plugins via xtask Source: https://github.com/gillesvink/opendefocus/blob/main/docs/src/developer/building.md This command triggers the build process for specific Nuke versions using the project's xtask system. It compiles the binaries for the Linux platform and packages them into the output directory. ```bash cargo xtask \ --compile \ --nuke-versions 15.1,15.2 \ --target-platform linux \ --output-to-package ``` -------------------------------- ### Configure Defocus Settings Source: https://context7.com/gillesvink/opendefocus/llms.txt Sets up the circle of confusion for blur radius and enables depth-based or uniform 2D defocus. It also allows for scaling, gamma correction, and focal plane adjustments. ```rust use opendefocus::datamodel::{Settings, defocus::DefocusMode}; let mut settings = Settings::default(); // Basic defocus configuration settings.defocus.circle_of_confusion.size = 30.0; // Base blur radius in pixels settings.defocus.circle_of_confusion.max_size = 50.0; // Maximum blur radius settings.defocus.circle_of_confusion.pixel_aspect = 1.0; // Pixel aspect ratio // Switch between 2D (uniform) and depth-based defocus settings.defocus.set_defocus_mode(DefocusMode::Twod); // Uniform blur // or settings.defocus.set_defocus_mode(DefocusMode::Depth); // Depth-based blur // Additional defocus controls settings.defocus.size_multiplier = 1.5; // Scale the defocus size settings.defocus.gamma_correction = 1.2; // Boost bokeh brightness settings.defocus.focal_plane_offset = 0.0; // Offset focal plane settings.defocus.use_direct_math = false; // Use direct depth values ``` -------------------------------- ### Configure Bokeh Creator Settings Source: https://context7.com/gillesvink/opendefocus/llms.txt Generates custom bokeh shapes by adjusting aperture blade count, curvature, and rotation. It also controls bokeh appearance like edge softness and ring brightness. ```rust use opendefocus::datamodel::Settings; let mut settings = Settings::default(); // Aperture blade configuration settings.bokeh.blades = 8; // Number of aperture blades (0 = circular) settings.bokeh.curvature = 0.3; // Blade curvature (-1.0 to 1.0) settings.bokeh.rotation = 15.0; // Rotation in degrees // Bokeh appearance settings.bokeh.softness = 0.1; // Edge softness settings.bokeh.ring_width = 0.2; // Width of bright ring at edge settings.bokeh.ring_brightness = 1.5; // Brightness of ring ``` -------------------------------- ### POST /render Source: https://context7.com/gillesvink/opendefocus/llms.txt Performs a depth-of-field render operation using the provided settings and image data. ```APIDOC ## POST /render ### Description Processes an input image to apply realistic depth-of-field effects based on the provided configuration settings. ### Method POST ### Endpoint /render ### Parameters #### Request Body - **settings** (protobuf) - Required - Serialized OpenDefocus Settings object containing bokeh parameters and camera data. - **image_data** (binary) - Required - The source image buffer to be processed. ### Request Example { "settings": "base64_encoded_protobuf_data", "image_data": "binary_blob" } ### Response #### Success Response (200) - **output_image** (binary) - The rendered image with applied depth-of-field. #### Response Example { "status": "success", "output_image": "binary_blob" } ``` -------------------------------- ### Perform Pre-commit Checks Source: https://github.com/gillesvink/opendefocus/blob/main/docs/src/developer/xtask.md Runs automated pre-commit checks to ensure code quality and project standards before committing changes. ```bash cargo xtask --precomit ``` -------------------------------- ### Configure Filter and Bokeh Settings Source: https://context7.com/gillesvink/opendefocus/llms.txt Selects the convolution filter mode, including simple disc, generated bokeh, or a custom image. It also controls filter resolution and enables a preview mode for the filter kernel. ```rust use opendefocus::datamodel::{Settings, render::FilterMode}; let mut settings = Settings::default(); // Filter mode selection settings.render.filter.set_mode(FilterMode::Simple); // Fast simple disc settings.render.filter.set_mode(FilterMode::BokehCreator); // Generated bokeh settings.render.filter.set_mode(FilterMode::Image); // Custom filter image // Filter resolution (higher = more detail, slower) settings.render.filter.resolution = 256; // Preview mode - render only the filter kernel settings.render.filter.preview = true; ``` -------------------------------- ### Configure Render Quality Settings Source: https://context7.com/gillesvink/opendefocus/llms.txt Adjusts rendering quality and performance by setting sample counts for convolution. Supports presets like Low, Medium, High, and Custom, along with farm rendering quality and GPU preference. ```rust use opendefocus::datamodel::{Settings, render::Quality}; let mut settings = Settings::default(); // Quality presets settings.render.set_quality(Quality::Low); // Fast preview (8-20 samples) settings.render.set_quality(Quality::Medium); // Balanced (12-50 samples) settings.render.set_quality(Quality::High); // Final render (30-100 samples) settings.render.set_quality(Quality::Custom); // Use custom sample count // Custom sample count (when Quality::Custom is set) settings.render.samples = 64; // Separate quality for GUI vs farm rendering settings.render.set_farm_quality(Quality::High); settings.render.gui = true; // Use gui quality when true // Additional render settings settings.render.timeout = Some(60); // Render timeout in seconds settings.render.inverse_y = false; // Flip Y coordinate interpretation settings.render.use_gpu_if_available = true; // Prefer GPU rendering ``` -------------------------------- ### Configure Nuke Environment Path Source: https://github.com/gillesvink/opendefocus/blob/main/docs/src/developer/building.md Sets the NUKE_PATH environment variable to the location of the compiled package, allowing Nuke to discover the plugin. ```bash export NUKE_PATH=$(pwd)/package ``` -------------------------------- ### Render Full Image Defocus Source: https://context7.com/gillesvink/opendefocus/llms.txt Shows the process of applying a defocus effect to an entire image. It involves configuring the circle of confusion radius, loading an image into an ndarray, and executing the render. ```rust use anyhow::Result; use image::{DynamicImage, Rgba32FImage}; use image_ndarray::prelude::ImageArray; use opendefocus::OpenDefocusRenderer; use opendefocus::datamodel::Settings; #[tokio::main] async fn main() -> Result<()> { let mut settings = Settings::default(); // Configure defocus size (circle of confusion radius in pixels) settings.defocus.circle_of_confusion.size = 25.0; // Initialize renderer let renderer = OpenDefocusRenderer::new(true, &mut settings).await?; // Load image and convert to ndarray let image = image::open("input.png")?.to_rgba32f(); let mut array = image.to_ndarray(); // Render defocus effect (image, depth map, custom filter) renderer .render(settings, array.view_mut(), None, None) .await?; // Save result let output: Rgba32FImage = Rgba32FImage::from_ndarray(array)?; DynamicImage::from(output).to_rgba8().save("output.png")?; Ok(()) } ``` -------------------------------- ### Configure Barndoors Effect in Rust Source: https://context7.com/gillesvink/opendefocus/llms.txt Configures the matte box obstruction effect to clip bokeh shapes at image edges. It allows individual control over top, bottom, left, and right barndoor positions. ```rust use opendefocus::datamodel::Settings; let mut settings = Settings::default(); // Enable barndoors effect settings.non_uniform.barndoors.enable = true; settings.non_uniform.barndoors.amount = 0.6; // Effect strength settings.non_uniform.barndoors.gamma = 1.0; // Gamma correction // Individual side control (percentage from edge) settings.non_uniform.barndoors.top = 80.0; // Top barndoor position settings.non_uniform.barndoors.bottom = 100.0; // Bottom barndoor position settings.non_uniform.barndoors.left = 90.0; // Left barndoor position settings.non_uniform.barndoors.right = 90.0; // Right barndoor position // Direction controls settings.non_uniform.barndoors.inverse = false; settings.non_uniform.barndoors.inverse_foreground = true; ``` -------------------------------- ### Configure Axial Aberration in Rust Source: https://context7.com/gillesvink/opendefocus/llms.txt Simulates longitudinal chromatic aberration by adjusting color fringing based on focus distance using specific color type presets. ```rust use opendefocus::datamodel::{Settings, non_uniform::AxialAberrationType}; let mut settings = Settings::default(); // Enable axial aberration settings.non_uniform.axial_aberration.enable = true; settings.non_uniform.axial_aberration.amount = 0.5; // Effect strength // Color type selection settings.non_uniform.axial_aberration.set_color_type(AxialAberrationType::RedBlue); ``` -------------------------------- ### Render with Custom Bokeh Filters in Rust Source: https://context7.com/gillesvink/opendefocus/llms.txt Uses a custom image as a bokeh filter to achieve unique bokeh shapes during the rendering process. ```rust use ndarray::Array3; use image_ndarray::prelude::ImageArray; use opendefocus::OpenDefocusRenderer; use opendefocus::datamodel::{Settings, render::FilterMode}; #[tokio::main] async fn main() -> anyhow::Result<()> { let mut settings = Settings::default(); // Enable image filter mode settings.render.filter.set_mode(FilterMode::Image); // Load custom bokeh filter (RGBA image) let filter_image = image::open("custom_bokeh.png")?.to_rgba32f(); let filter: Array3 = filter_image.to_ndarray(); // Load main image let main_image = image::open("input.png")?.to_rgba32f(); let mut image = main_image.to_ndarray(); let renderer = OpenDefocusRenderer::new(true, &mut settings).await?; // Render with custom filter renderer .render(settings, image.view_mut(), None, Some(filter)) .await?; Ok(())} ``` -------------------------------- ### Configure Inverse Foreground Bokeh in Rust Source: https://context7.com/gillesvink/opendefocus/llms.txt Sets whether non-uniform effects like catseye and barndoors should be inverted for foreground elements compared to the background. ```rust use opendefocus::datamodel::Settings; let mut settings = Settings::default(); // Global inverse foreground setting settings.non_uniform.inverse_foreground = true; // Per-effect inverse foreground (catseye and barndoors) settings.non_uniform.catseye.inverse_foreground = true; settings.non_uniform.barndoors.inverse_foreground = true; ``` -------------------------------- ### Render with Depth Maps in Rust Source: https://context7.com/gillesvink/opendefocus/llms.txt Performs depth-based rendering by providing a normalized depth map to the renderer to achieve realistic depth-of-field. ```rust use ndarray::{Array2, Array3}; use opendefocus::OpenDefocusRenderer; use opendefocus::datamodel::{Settings, defocus::DefocusMode}; #[tokio::main] async fn main() -> anyhow::Result<()> { let mut settings = Settings::default(); // Enable depth-based defocus settings.defocus.set_defocus_mode(DefocusMode::Depth); settings.defocus.circle_of_confusion.max_size = 50.0; // Create or load depth map (single channel, normalized 0.0-1.0) let depth: Array2 = Array2::zeros((1080, 1920)); // Load actual depth data // Load RGBA image let mut image: Array3 = Array3::zeros((1080, 1920, 4)); let renderer = OpenDefocusRenderer::new(true, &mut settings).await?; // Render with depth map renderer .render(settings, image.view_mut(), Some(depth), None) .await?; Ok(())} ``` -------------------------------- ### Configure Catseye Effect Source: https://context7.com/gillesvink/opendefocus/llms.txt Simulates mechanical or optical vignetting to create 'cat-eyed' bokeh shapes. This includes enabling the effect, adjusting its strength, gamma, softness, and direction controls. ```rust use opendefocus::datamodel::Settings; let mut settings = Settings::default(); // Enable catseye effect settings.non_uniform.catseye.enable = true; settings.non_uniform.catseye.amount = 0.7; // Effect strength (0.0-1.0) settings.non_uniform.catseye.gamma = 1.0; // Gamma correction settings.non_uniform.catseye.softness = 0.2; // Edge softness // Direction controls settings.non_uniform.catseye.inverse = false; // Invert direction settings.non_uniform.catseye.inverse_foreground = true; // Different for foreground settings.non_uniform.catseye.relative_to_screen = false; // Screen vs lens relative ``` -------------------------------- ### Configure Astigmatism Effect in Rust Source: https://context7.com/gillesvink/opendefocus/llms.txt Enables the astigmatism effect to create stretched bokeh shapes that radiate toward the image edges. ```rust use opendefocus::datamodel::Settings; let mut settings = Settings::default(); // Enable astigmatism settings.non_uniform.astigmatism.enable = true; settings.non_uniform.astigmatism.amount = 0.5; // Stretch amount settings.non_uniform.astigmatism.gamma = 1.0; // Gamma correction ``` -------------------------------- ### OpenDefocusRenderer::render_stripe Source: https://context7.com/gillesvink/opendefocus/llms.txt Renders defocus effects on a specific portion (stripe) of an image. This is optimized for interactive viewers that process images in chunks and supports specifying render regions with padding. ```APIDOC ## OpenDefocusRenderer::render_stripe ### Description Renders defocus on a portion (stripe) of an image, useful for interactive viewers like Nuke that process images in chunks. This method allows specifying both the full region and the render region with optional padding. ### Method `OpenDefocusRenderer::render_stripe` ### Endpoint N/A (This is a library function, not an HTTP endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None (Operates on image data passed as arguments) ### Request Example ```rust use ndarray::{Array3, s}; use opendefocus::{ OpenDefocusRenderer, datamodel::render::RenderSpecs, datamodel::{IVector4, Settings, UVector2}, }; #[tokio::main] async fn main() -> anyhow::Result<()> { let mut image: Array3 = Array3::zeros((256, 256, 4)); let mut settings = Settings::default(); settings.render.resolution = UVector2 { x: 256, y: 256 }; // Define full stripe region (x, y, width, height) let full_region = IVector4 { x: 0, y: 0, z: 256, w: 256 }; // Define render region with padding (skip 10 pixels on each edge) let render_region = IVector4 { x: 10, y: 10, z: 246, w: 246 }; let render_specs = RenderSpecs { full_region, render_region }; let renderer = OpenDefocusRenderer::new(true, &mut settings).await?; renderer .render_stripe(render_specs, settings, image.view_mut(), None, None) .await?; Ok(()) } ``` ### Response #### Success Response (200) - **Modified Image Stripe**: The specified portion of the input image array is modified in-place with the defocus effect applied. #### Response Example (No direct JSON response, modifies image data in-place) ``` -------------------------------- ### OpenDefocusRenderer::render Source: https://context7.com/gillesvink/opendefocus/llms.txt Renders defocus effects on an image array. This is the primary method for applying convolution effects to an entire image, supporting depth maps and custom filters. ```APIDOC ## OpenDefocusRenderer::render ### Description Renders defocus effects on the provided image array. This is the primary method for applying convolution effects to an entire image with automatic region detection. ### Method `OpenDefocusRenderer::render` ### Endpoint N/A (This is a library function, not an HTTP endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None (Operates on image data passed as arguments) ### Request Example ```rust use anyhow::Result; use image::{DynamicImage, Rgba32FImage}; use image_ndarray::prelude::ImageArray; use opendefocus::OpenDefocusRenderer; use opendefocus::datamodel::Settings; #[tokio::main] async fn main() -> Result<()> { let mut settings = Settings::default(); // Configure defocus size (circle of confusion radius in pixels) settings.defocus.circle_of_confusion.size = 25.0; // Initialize renderer let renderer = OpenDefocusRenderer::new(true, &mut settings).await?; // Load image and convert to ndarray let image = image::open("input.png")?.to_rgba32f(); let mut array = image.to_ndarray(); // Render defocus effect (image, depth map, custom filter) renderer .render(settings, array.view_mut(), None, None) .await?; // Save result let output: Rgba32FImage = Rgba32FImage::from_ndarray(array)?; DynamicImage::from(output).to_rgba8().save("output.png")?; Ok(()) } ``` ### Response #### Success Response (200) - **Modified Image Array**: The input image array is modified in-place with the defocus effect applied. #### Response Example (No direct JSON response, modifies image data in-place and saves to file) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.