You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(originalImg, themeColor = "#e62429", uiTitle = "Big Hero 6: The Series Database") {
// Create main container
const container = document.createElement('div');
// Inject Fonts and Styles
const style = document.createElement('style');
style.textContent = `
@import url('https://fonts.googleapis.com/css2?family=Teko:wght@400;600&family=Roboto:wght@400;700&display=swap');
.bh6-tool-wrapper {
font-family: 'Roboto', sans-serif;
background: #111;
color: #fff;
display: flex;
flex-wrap: wrap;
width: 100%;
max-width: 900px;
border: 2px solid ${themeColor};
border-radius: 12px;
overflow: hidden;
box-shadow: 0 4px 25px rgba(230, 36, 41, 0.3);
box-sizing: border-box;
}
.bh6-image-section {
flex: 1 1 500px;
position: relative;
background: #050505;
background-image:
linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
background-size: 20px 20px;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
border-right: 2px solid #333;
min-height: 300px;
}
.bh6-image-section canvas {
max-width: 100%;
max-height: 500px;
object-fit: contain;
display: block;
z-index: 2;
}
.bh6-scanner {
position: absolute;
top: -10px;
left: 0;
width: 100%;
height: 4px;
background: ${themeColor};
box-shadow: 0 0 15px ${themeColor}, 0 0 30px ${themeColor};
display: none;
z-index: 3;
animation: bh6-scan 2.5s ease-in-out infinite;
}
@keyframes bh6-scan {
0% { top: 0%; }
50% { top: 100%; }
100% { top: 0%; }
}
.bh6-info-section {
flex: 1 1 300px;
padding: 30px;
display: flex;
flex-direction: column;
background: #141414;
box-sizing: border-box;
}
.bh6-title {
font-family: 'Teko', sans-serif;
font-size: 36px;
color: ${themeColor};
margin: 0;
text-transform: uppercase;
letter-spacing: 1.5px;
border-bottom: 1px solid #333;
padding-bottom: 10px;
}
.bh6-desc {
color: #bbb;
font-size: 14px;
line-height: 1.6;
margin: 15px 0;
}
.bh6-btn {
background: ${themeColor};
color: #fff;
border: 2px solid ${themeColor};
padding: 12px 20px;
font-size: 22px;
text-transform: uppercase;
cursor: pointer;
border-radius: 6px;
margin-top: 10px;
transition: all 0.3s ease;
font-family: 'Teko', sans-serif;
letter-spacing: 1.5px;
box-shadow: 0 0 10px rgba(230, 36, 41, 0.4);
}
.bh6-btn:hover:not(:disabled) {
background: transparent;
color: ${themeColor};
box-shadow: 0 0 20px rgba(230, 36, 41, 0.6);
}
.bh6-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
box-shadow: none;
}
.bh6-status {
margin-top: 20px;
font-style: italic;
color: #888;
font-size: 14px;
height: 20px;
}
.bh6-results {
margin-top: 25px;
display: none;
background: #000;
border: 1px solid #333;
border-radius: 8px;
padding: 20px;
animation: fadeIn 0.5s ease;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.bh6-results h3 {
margin: 0 0 15px 0;
color: ${themeColor};
font-family: 'Teko', sans-serif;
font-size: 26px;
letter-spacing: 1px;
text-transform: uppercase;
}
.bh6-result-item {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px dashed #333;
padding: 8px 0;
}
.bh6-result-item:last-child {
border-bottom: none;
}
.bh6-result-label {
color: #888;
font-size: 14px;
text-transform: uppercase;
font-weight: 600;
}
.bh6-result-value {
font-weight: 700;
color: #fff;
font-size: 16px;
}
.bh6-tag {
background: rgba(230, 36, 41, 0.2);
color: ${themeColor};
padding: 2px 8px;
border-radius: 4px;
font-size: 12px;
margin-left: 10px;
border: 1px solid rgba(230, 36, 41, 0.5);
}
`;
container.appendChild(style);
// Build the UI Layout
const wrapper = document.createElement('div');
wrapper.className = 'bh6-tool-wrapper';
wrapper.innerHTML = `
<div class="bh6-image-section">
<canvas class="bh6-canvas"></canvas>
<div class="bh6-scanner"></div>
</div>
<div class="bh6-info-section">
<h2 class="bh6-title">${uiTitle}</h2>
<p class="bh6-desc">Initiate reverse frame analysis to match the uploaded image/video frame against the San Fransokyo Institute of Technology visual archives (2017-2021).</p>
<button class="bh6-btn">Initiate Search</button>
<div class="bh6-status">System Standby...</div>
<div class="bh6-results">
<h3>Match Confirmed <span class="bh6-tag">SFIT-DB-1</span></h3>
<div class="bh6-result-item">
<span class="bh6-result-label">Confidence:</span>
<span class="bh6-result-value bh6-val-conf"></span>
</div>
<div class="bh6-result-item">
<span class="bh6-result-label">Season:</span>
<span class="bh6-result-value bh6-val-season"></span>
</div>
<div class="bh6-result-item">
<span class="bh6-result-label">Episode:</span>
<span class="bh6-result-value bh6-val-episode"></span>
</div>
<div class="bh6-result-item">
<span class="bh6-result-label">Timestamp:</span>
<span class="bh6-result-value bh6-val-time"></span>
</div>
</div>
</div>
`;
container.appendChild(wrapper);
// Draw the image to the canvas safely
const canvas = container.querySelector('.bh6-canvas');
const ctx = canvas.getContext('2d');
canvas.width = originalImg.width;
canvas.height = originalImg.height;
ctx.drawImage(originalImg, 0, 0);
// Dom elements references
const btn = container.querySelector('.bh6-btn');
const scanner = container.querySelector('.bh6-scanner');
const status = container.querySelector('.bh6-status');
const results = container.querySelector('.bh6-results');
// Deterministic hashing algorithm to generate consistent "fake" search results based on the image
const getImageHash = (img) => {
try {
const hCanvas = document.createElement('canvas');
hCanvas.width = 16;
hCanvas.height = 16;
const hCtx = hCanvas.getContext('2d');
hCtx.drawImage(img, 0, 0, 16, 16);
const data = hCtx.getImageData(0, 0, 16, 16).data;
let hash = 0;
for(let i = 0; i < data.length; i++) {
hash = (hash * 31 + data[i]) % 1000000007;
}
return (hash < 0) ? -hash : hash; // keep it positive
} catch(e) {
// Fallback for tainted canvas (CORS issues)
return Math.floor(Math.random() * 1000000007);
}
};
// Attach analysis event handler
btn.addEventListener('click', () => {
// Reset and prepare UI
results.style.display = 'none';
scanner.style.display = 'block';
btn.disabled = true;
btn.textContent = 'Searching...';
let progressStep = 0;
const statusSequence = [
'Analyzing RGB distributions...',
'Connecting to SFIT Servers...',
'Scanning Season 1 archives...',
'Comparing Season 2 & 3 databases...',
'Cross-referencing character vector models...',
'Match isolated. Retrieving metadata...'
];
// Simulate network/database search interval
const searchInterval = setInterval(() => {
if (progressStep < statusSequence.length) {
status.textContent = statusSequence[progressStep];
progressStep++;
} else {
clearInterval(searchInterval);
scanner.style.display = 'none';
btn.disabled = false;
btn.textContent = 'Initiate Search';
status.textContent = 'Analysis complete.';
// Calculate deterministic mock results
const hash = getImageHash(originalImg) || 84950392;
// Big Hero 6 The Series Structure
// Season 1: 25 eps, Season 2: 25 eps, Season 3: 10 eps
const season = (hash % 3) + 1;
const maxEpisodes = season === 3 ? 10 : 25;
const episode = ((hash >> 3) % maxEpisodes) + 1;
// Standard episode length is ~22 mins
const min = ((hash >> 5) % 22);
const sec = ((hash >> 7) % 60);
const timeStr = `${min.toString().padStart(2, '0')}:${sec.toString().padStart(2, '0')}`;
// Confidence mostly high for realistic feel (80.0% to 99.9%)
const confidence = (80 + ((hash % 199) / 10)).toFixed(2);
// Populate data
container.querySelector('.bh6-val-conf').textContent = `${confidence}%`;
container.querySelector('.bh6-val-conf').style.color = confidence > 90 ? '#4CAF50' : '#FFC107';
container.querySelector('.bh6-val-season').textContent = `Season ${season}`;
container.querySelector('.bh6-val-episode').textContent = `Episode ${episode}`;
container.querySelector('.bh6-val-time').textContent = timeStr;
// Show Results
results.style.display = 'block';
}
}, 600); // Step every 600ms
});
return container;
}
Apply Changes