Please bookmark this page to avoid losing your image tool!

Image To Online Website Address Converter

(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, format = "png", imageScale = "1") {
    // Determine the output MIME type
    const validFormats = ["png", "jpeg", "webp"];
    const outFormat = validFormats.includes(format.toLowerCase()) ? format.toLowerCase() : "png";
    const mimeType = "image/" + outFormat;
    
    // Parse the scale parameter
    const scaleFactor = Math.max(0.01, parseFloat(imageScale)) || 1;
    
    // Setup canvas
    const canvas = document.createElement("canvas");
    canvas.width = Math.max(1, Math.floor(originalImg.width * scaleFactor));
    canvas.height = Math.max(1, Math.floor(originalImg.height * scaleFactor));
    const ctx = canvas.getContext("2d");
    
    // If output is JPEG, provide a white background instead of transparent black
    if (mimeType === "image/jpeg") {
        ctx.fillStyle = "#ffffff";
        ctx.fillRect(0, 0, canvas.width, canvas.height);
    }
    
    // Draw the image
    ctx.drawImage(originalImg, 0, 0, canvas.width, canvas.height);
    
    // Convert image to a Data URI, which serves as a usable website address (URL)
    const dataUrl = canvas.toDataURL(mimeType, 0.92);
    
    // Build the UI container
    const container = document.createElement("div");
    container.style.fontFamily = "system-ui, -apple-system, sans-serif";
    container.style.padding = "20px";
    container.style.border = "1px solid #e0e0e0";
    container.style.borderRadius = "8px";
    container.style.backgroundColor = "#fafafa";
    container.style.color = "#333333";
    container.style.maxWidth = "100%";
    container.style.boxSizing = "border-box";
    
    const header = document.createElement("h3");
    header.textContent = "Image to Web Address (Data URI)";
    header.style.marginTop = "0";
    header.style.marginBottom = "8px";
    
    const description = document.createElement("p");
    description.textContent = "Your image has been converted into a Data URI. This acts as a complete, standalone web URL that can be accessed online/offline directly in a browser's address bar or used within HTML code.";
    description.style.fontSize = "14px";
    description.style.color = "#555555";
    description.style.marginBottom = "15px";
    description.style.lineHeight = "1.5";
    
    const textarea = document.createElement("textarea");
    textarea.value = dataUrl;
    textarea.readOnly = true;
    textarea.style.width = "100%";
    textarea.style.height = "120px";
    textarea.style.padding = "10px";
    textarea.style.boxSizing = "border-box";
    textarea.style.fontFamily = "SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace";
    textarea.style.fontSize = "12px";
    textarea.style.border = "1px solid #cccccc";
    textarea.style.borderRadius = "4px";
    textarea.style.marginBottom = "15px";
    textarea.style.resize = "vertical";
    textarea.style.backgroundColor = "#ffffff";
    textarea.onclick = () => textarea.select();
    
    const controls = document.createElement("div");
    controls.style.display = "flex";
    controls.style.gap = "10px";
    controls.style.flexWrap = "wrap";
    
    const copyBtn = document.createElement("button");
    copyBtn.textContent = "Copy Address";
    copyBtn.style.padding = "10px 16px";
    copyBtn.style.backgroundColor = "#007bff";
    copyBtn.style.color = "#ffffff";
    copyBtn.style.border = "none";
    copyBtn.style.borderRadius = "4px";
    copyBtn.style.fontSize = "14px";
    copyBtn.style.fontWeight = "500";
    copyBtn.style.cursor = "pointer";
    copyBtn.style.transition = "background-color 0.2s";
    
    copyBtn.onmouseover = () => copyBtn.style.backgroundColor = "#0056b3";
    copyBtn.onmouseout = () => copyBtn.style.backgroundColor = "#007bff";
    
    copyBtn.onclick = () => {
        navigator.clipboard.writeText(dataUrl).then(() => {
            const origText = copyBtn.textContent;
            copyBtn.textContent = "Copied to Clipboard!";
            copyBtn.style.backgroundColor = "#28a745";
            setTimeout(() => {
                copyBtn.textContent = origText;
                copyBtn.style.backgroundColor = "#007bff";
            }, 2500);
        }).catch(err => {
            console.error("Failed to copy text: ", err);
        });
    };
    
    const openLink = document.createElement("a");
    openLink.href = dataUrl;
    openLink.target = "_blank";
    openLink.textContent = "Open Address in New Tab";
    openLink.style.padding = "10px 16px";
    openLink.style.backgroundColor = "#6c757d";
    openLink.style.color = "#ffffff";
    openLink.style.textDecoration = "none";
    openLink.style.borderRadius = "4px";
    openLink.style.fontSize = "14px";
    openLink.style.fontWeight = "500";
    openLink.style.display = "inline-block";
    openLink.style.transition = "background-color 0.2s";
    
    openLink.onmouseover = () => openLink.style.backgroundColor = "#5a6268";
    openLink.onmouseout = () => openLink.style.backgroundColor = "#6c757d";
    
    controls.appendChild(copyBtn);
    controls.appendChild(openLink);
    
    container.appendChild(header);
    container.appendChild(description);
    container.appendChild(textarea);
    container.appendChild(controls);
    
    return container;
}

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 converts images into Data URI strings, which function as standalone web addresses that contain the image data itself. Users can customize the conversion by selecting different output formats such as PNG, JPEG, or WebP and adjusting the image scale to manage file size. This is particularly useful for web developers who need to embed images directly into HTML or CSS code, or for anyone looking to represent an image as a single, portable text string that can be used without hosting an external image file.

Leave a Reply

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