Please bookmark this page to avoid losing your image tool!

Video Aspect Ratio Changer To 2.55:1

(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.
function processImage(originalImg, mode = "pad", bgColor = "#000000") {
    // Target exact aspect ratio of 2.55:1
    const targetRatio = 2.55;
    
    // Get original dimensions
    const width = originalImg.naturalWidth || originalImg.width;
    const height = originalImg.naturalHeight || originalImg.height;
    const imgRatio = width / height;

    let canvasWidth, canvasHeight;
    let drawX = 0, drawY = 0, drawW = width, drawH = height;

    // Determine new canvas dimensions and image placement based on mode
    if (mode.toLowerCase() === "crop") {
        if (imgRatio > targetRatio) {
            // Original is wider than 2.55:1 - crop the left and right sides
            canvasHeight = height;
            canvasWidth = height * targetRatio;
            drawX = -(width - canvasWidth) / 2;
            drawY = 0;
        } else {
            // Original is taller than 2.55:1 - crop the top and bottom
            canvasWidth = width;
            canvasHeight = width / targetRatio;
            drawX = 0;
            drawY = -(height - canvasHeight) / 2;
        }
    } else {
        // "pad" or letterbox/pillarbox mode
        if (imgRatio > targetRatio) {
            // Original is wider than 2.55:1 - add letterbox (pad top and bottom)
            canvasWidth = width;
            canvasHeight = width / targetRatio;
            drawX = 0;
            drawY = (canvasHeight - height) / 2;
        } else {
            // Original is taller than 2.55:1 - add pillarbox (pad left and right)
            canvasHeight = height;
            canvasWidth = height * targetRatio;
            drawX = (canvasWidth - width) / 2;
            drawY = 0;
        }
    }

    // Create canvas
    const canvas = document.createElement("canvas");
    canvas.width = canvasWidth;
    canvas.height = canvasHeight;
    const ctx = canvas.getContext("2d");

    // Fill the background (visible when padding or if the image has transparency)
    ctx.fillStyle = bgColor;
    ctx.fillRect(0, 0, canvasWidth, canvasHeight);

    // Draw the original image with calculated offsets
    ctx.drawImage(originalImg, drawX, drawY, drawW, drawH);

    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

This tool allows users to adjust the aspect ratio of their videos or images to the specific 2.55:1 cinematic widescreen format. It offers two primary methods for resizing: cropping the content to fill the new frame or adding padding (letterboxing or pillarboxing) to preserve the original image dimensions. This is particularly useful for filmmakers, video editors, or content creators looking to achieve a specific anamorphic widescreen look for cinematic presentations.

Leave a Reply

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