Please bookmark this page to avoid losing your image tool!

Image Search Tool For Microsoft Bing

(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, buttonColor = '#0078D4') {
    // Create a container for the UI
    const container = document.createElement('div');
    container.style.display = 'flex';
    container.style.flexDirection = 'column';
    container.style.alignItems = 'center';
    container.style.justifyContent = 'center';
    container.style.fontFamily = '"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';
    container.style.padding = '20px';
    container.style.backgroundColor = '#f9f9f9';
    container.style.border = '1px solid #e0e0e0';
    container.style.borderRadius = '8px';
    container.style.maxWidth = '100%';
    container.style.boxSizing = 'border-box';

    // Title
    const title = document.createElement('h2');
    title.textContent = 'Microsoft Bing Image Search';
    title.style.margin = '0 0 15px 0';
    title.style.color = '#333';
    container.appendChild(title);

    // Canvas to draw the image for preview and blob conversion
    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d');
    canvas.width = originalImg.width;
    canvas.height = originalImg.height;
    ctx.drawImage(originalImg, 0, 0);

    // Responsive preview scaling
    const maxPreviewWidth = Math.min(400, window.innerWidth - 80);
    const scale = originalImg.width > maxPreviewWidth ? maxPreviewWidth / originalImg.width : 1;
    const previewWidth = originalImg.width * scale;
    const previewHeight = originalImg.height * scale;

    canvas.style.width = `${previewWidth}px`;
    canvas.style.height = `${previewHeight}px`;
    canvas.style.border = '1px solid #ccc';
    canvas.style.borderRadius = '6px';
    canvas.style.marginBottom = '20px';
    canvas.style.boxShadow = '0 4px 8px rgba(0,0,0,0.1)';
    container.appendChild(canvas);

    // Search Button
    const searchBtn = document.createElement('button');
    searchBtn.innerHTML = `
        <svg style="width:18px;height:18px;margin-right:8px;vertical-align:middle;fill:currentColor;" viewBox="0 0 24 24">
            <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
        </svg>
        <span style="vertical-align:middle;">Search Image on Bing</span>
    `;
    searchBtn.style.backgroundColor = buttonColor;
    searchBtn.style.color = '#ffffff';
    searchBtn.style.border = 'none';
    searchBtn.style.padding = '12px 24px';
    searchBtn.style.fontSize = '16px';
    searchBtn.style.fontWeight = 'bold';
    searchBtn.style.borderRadius = '4px';
    searchBtn.style.cursor = 'pointer';
    searchBtn.style.boxShadow = '0 2px 4px rgba(0,0,0,0.2)';
    searchBtn.style.transition = 'background-color 0.2s, transform 0.1s';
    
    // Hover effects
    searchBtn.onmouseover = () => {
        searchBtn.style.filter = 'brightness(0.9)';
    };
    searchBtn.onmouseout = () => {
        searchBtn.style.filter = 'none';
    };
    searchBtn.onmousedown = () => {
        searchBtn.style.transform = 'scale(0.98)';
    };
    searchBtn.onmouseup = () => {
        searchBtn.style.transform = 'scale(1)';
    };

    // Subtext for context
    const hintText = document.createElement('p');
    hintText.textContent = "Opens Bing Visual Search in a new tab securely.";
    hintText.style.fontSize = '12px';
    hintText.style.color = '#666';
    hintText.style.marginTop = '10px';

    searchBtn.onclick = () => {
        searchBtn.disabled = true;
        searchBtn.innerHTML = 'Preparing Search...';
        
        canvas.toBlob((blob) => {
            // Create a hidden form to submit the image directly to Bing
            const form = document.createElement('form');
            form.method = 'POST';
            // Bing's traditional reverse image search upload endpoint
            form.action = 'https://www.bing.com/images/search?view=detailv2&iss=sbi';
            form.target = '_blank';
            form.enctype = 'multipart/form-data';
            form.style.display = 'none';

            // Input element for the image file
            const fileInput = document.createElement('input');
            fileInput.type = 'file';
            fileInput.name = 'imageBin'; // Parameter expected by Bing

            // A secondary input in case the endpoint routes require standard "image" name
            const altFileInput = document.createElement('input');
            altFileInput.type = 'file';
            altFileInput.name = 'image';
            
            // Generate a File object from the blob
            const file = new File([blob], 'search_image.jpg', { type: 'image/jpeg' });
            
            // DataTransfer is used to programmatically set files on HTMLInputElement
            const dataTransfer = new DataTransfer();
            dataTransfer.items.add(file);
            
            fileInput.files = dataTransfer.files;
            altFileInput.files = dataTransfer.files;

            form.appendChild(fileInput);
            form.appendChild(altFileInput);
            document.body.appendChild(form);

            form.submit();

            // Cleanup form after submission
            setTimeout(() => {
                document.body.removeChild(form);
                
                // Revert button text
                searchBtn.disabled = false;
                searchBtn.innerHTML = `
                    <svg style="width:18px;height:18px;margin-right:8px;vertical-align:middle;fill:currentColor;" viewBox="0 0 24 24">
                        <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
                    </svg>
                    <span style="vertical-align:middle;">Search Image on Bing</span>
                `;
            }, 1000);

        }, 'image/jpeg', 0.9);
    };

    container.appendChild(searchBtn);
    container.appendChild(hintText);

    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 allows users to perform a reverse image search using Microsoft Bing. By uploading or providing an image, the tool processes the file and automatically initiates a visual search on Bing in a new tab. It is useful for finding the original source of an image, identifying objects, products, or landmarks, and discovering visually similar content online.

Leave a Reply

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