Please bookmark this page to avoid losing your image tool!

Image Ultraviolet Camera Filter

(Free & Supports Bulk Upload)

Drag & drop your images here or

The result will appear here...
You can edit the below JavaScript code to customize the image tool.
/**
 * Applies a simulated ultraviolet (UV) camera filter to an image.
 * This effect is achieved by manipulating the color channels to create
 * a distinct blue/purple hue, characteristic of UV photography aesthetics.
 *
 * @param {HTMLImageElement} originalImg The original image object to process.
 * @returns {HTMLCanvasElement} A new canvas element with the UV filter applied.
 */
function processImage(originalImg) {
    // Create a new canvas element
    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d');

    // Set canvas dimensions to match the original image
    canvas.width = originalImg.naturalWidth;
    canvas.height = originalImg.naturalHeight;

    // Draw the original image onto the canvas
    ctx.drawImage(originalImg, 0, 0);

    // Get the image data from the canvas
    const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
    const data = imageData.data; // This is a Uint8ClampedArray

    // Iterate over each pixel (4 values at a time: R, G, B, A)
    for (let i = 0; i < data.length; i += 4) {
        const r = data[i];
        const g = data[i + 1];
        const b = data[i + 2];

        // Apply a transformation to simulate a UV filter effect.
        // This is done by reducing the red channel, slightly reducing the green,
        // and significantly boosting the blue channel to create a strong
        // blue/violet cast. The values are automatically clamped between 0 and 255.
        data[i] = r * 0.5;      // Red channel
        data[i + 1] = g * 0.7;  // Green channel
        data[i + 2] = b * 2.0;  // Blue channel
        // The alpha channel (data[i + 3]) is left unchanged.
    }

    // Put the modified image data back onto the canvas
    ctx.putImageData(imageData, 0, 0);

    // Return the canvas element with the filtered image
    return canvas;
}

Free Image Tool Creator

Can't find the image tool you're looking for?
Create one based on your own needs now!

Description

The Image Ultraviolet Camera Filter tool applies a simulated ultraviolet (UV) effect to images, transforming their colors to exhibit a distinct blue and purple hue reminiscent of UV photography. This filter is useful for artistic purposes, allowing users to create unique visuals, enhance photos for creative projects, or explore the aesthetic beauty of UV colors in digital photography.

Leave a Reply

Your email address will not be published. Required fields are marked *