update to node site
53
chromakey.js
@@ -1,53 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// Using Jimp for image processing
|
||||
const { Jimp } = require('jimp');
|
||||
|
||||
async function chromakeyImage() {
|
||||
try {
|
||||
const inputPath = path.join(__dirname, 'website', 'screenborder.jpg');
|
||||
const outputPath = path.join(__dirname, 'website', 'screenborder.png');
|
||||
|
||||
console.log('Loading image...');
|
||||
const image = await Jimp.read(inputPath);
|
||||
|
||||
console.log('Removing green screen...');
|
||||
|
||||
// Scan through each pixel
|
||||
image.scan(0, 0, image.bitmap.width, image.bitmap.height, function(x, y, idx) {
|
||||
const red = this.bitmap.data[idx + 0];
|
||||
const green = this.bitmap.data[idx + 1];
|
||||
const blue = this.bitmap.data[idx + 2];
|
||||
const alpha = this.bitmap.data[idx + 3];
|
||||
|
||||
// Very aggressive green detection
|
||||
const isGreen = green > red * 1.05 && green > blue * 1.05 && green > 30;
|
||||
|
||||
// Catch any bright greens
|
||||
const isBrightGreen = green > 120 && green > red && green > blue;
|
||||
|
||||
if (isGreen || isBrightGreen) {
|
||||
// Make pixel transparent
|
||||
this.bitmap.data[idx + 3] = 0;
|
||||
} else if (green > red || green > blue) {
|
||||
// Aggressively reduce alpha for any greenish tint
|
||||
const greenness = Math.max(
|
||||
(green - red) / 255,
|
||||
(green - blue) / 255
|
||||
);
|
||||
this.bitmap.data[idx + 3] = Math.floor(alpha * (1 - greenness));
|
||||
}
|
||||
});
|
||||
|
||||
console.log('Saving PNG...');
|
||||
await image.write(outputPath);
|
||||
|
||||
console.log('✓ Chromakey complete! Saved to website/screenborder.png');
|
||||
} catch (error) {
|
||||
console.error('✗ Chromakey failed:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
chromakeyImage();
|
||||
@@ -1,46 +0,0 @@
|
||||
const { Jimp } = require('jimp');
|
||||
const path = require('path');
|
||||
|
||||
async function createDisplacementMap() {
|
||||
const size = 512;
|
||||
const image = new Jimp({ width: size, height: size });
|
||||
|
||||
// Create a gentle CRT bulge displacement map
|
||||
// Center appears to bulge outward (magnified)
|
||||
// R channel = horizontal displacement
|
||||
// G channel = vertical displacement
|
||||
// 128 = no displacement, <128 = pull toward 0, >128 = push toward max
|
||||
|
||||
for (let y = 0; y < size; y++) {
|
||||
for (let x = 0; x < size; x++) {
|
||||
// Normalize to -1 to 1 range (center is 0,0)
|
||||
const nx = (x / (size - 1)) * 2 - 1;
|
||||
const ny = (y / (size - 1)) * 2 - 1;
|
||||
|
||||
// Use smooth cubic falloff for gentle curve
|
||||
// Pull edges slightly toward center (pincushion)
|
||||
const distSq = nx * nx + ny * ny;
|
||||
const strength = distSq * 0.15; // Gentle effect
|
||||
|
||||
// Direction away from center (positive = away from center)
|
||||
const dx = nx * strength;
|
||||
const dy = ny * strength;
|
||||
|
||||
// Convert to 0-255 range (128 = no displacement)
|
||||
const r = Math.floor(128 + dx * 127);
|
||||
const g = Math.floor(128 + dy * 127);
|
||||
|
||||
const idx = (y * size + x) * 4;
|
||||
image.bitmap.data[idx + 0] = Math.max(0, Math.min(255, r));
|
||||
image.bitmap.data[idx + 1] = Math.max(0, Math.min(255, g));
|
||||
image.bitmap.data[idx + 2] = 128;
|
||||
image.bitmap.data[idx + 3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
const outputPath = path.join(__dirname, 'website', 'bulge-map.png');
|
||||
await image.write(outputPath);
|
||||
console.log('✓ Displacement map created: website/bulge-map.png');
|
||||
}
|
||||
|
||||
createDisplacementMap();
|
||||
|
Before Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 379 B |
|
Before Width: | Height: | Size: 310 B |
|
Before Width: | Height: | Size: 367 B |
|
Before Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 208 B |
|
Before Width: | Height: | Size: 470 B |
|
Before Width: | Height: | Size: 438 B |
|
Before Width: | Height: | Size: 813 B |
|
Before Width: | Height: | Size: 476 B |
|
Before Width: | Height: | Size: 462 B |
|
Before Width: | Height: | Size: 958 B |
|
Before Width: | Height: | Size: 225 B |
|
Before Width: | Height: | Size: 375 B |
|
Before Width: | Height: | Size: 321 B |
|
Before Width: | Height: | Size: 513 B |
|
Before Width: | Height: | Size: 506 B |
|
Before Width: | Height: | Size: 273 B |
|
Before Width: | Height: | Size: 430 B |
|
Before Width: | Height: | Size: 321 B |
|
Before Width: | Height: | Size: 144 B |
|
Before Width: | Height: | Size: 165 B |
|
Before Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 199 B |
|
Before Width: | Height: | Size: 108 B |
|
Before Width: | Height: | Size: 128 B |
|
Before Width: | Height: | Size: 187 B |
|
Before Width: | Height: | Size: 306 B |
|
Before Width: | Height: | Size: 242 B |
|
Before Width: | Height: | Size: 364 B |
|
Before Width: | Height: | Size: 534 B |
|
Before Width: | Height: | Size: 414 B |
|
Before Width: | Height: | Size: 584 B |
|
Before Width: | Height: | Size: 368 B |
|
Before Width: | Height: | Size: 257 B |
|
Before Width: | Height: | Size: 674 B |
|
Before Width: | Height: | Size: 568 B |
|
Before Width: | Height: | Size: 632 B |
|
Before Width: | Height: | Size: 248 B |
|
Before Width: | Height: | Size: 405 B |
|
Before Width: | Height: | Size: 570 B |
|
Before Width: | Height: | Size: 349 B |
|
Before Width: | Height: | Size: 675 B |
|
Before Width: | Height: | Size: 696 B |
|
Before Width: | Height: | Size: 407 B |
|
Before Width: | Height: | Size: 386 B |
|
Before Width: | Height: | Size: 550 B |
|
Before Width: | Height: | Size: 287 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 335 B |
|
Before Width: | Height: | Size: 168 B |
|
Before Width: | Height: | Size: 102 B |
|
Before Width: | Height: | Size: 115 B |
|
Before Width: | Height: | Size: 123 B |
|
Before Width: | Height: | Size: 140 B |
|
Before Width: | Height: | Size: 143 B |
|
Before Width: | Height: | Size: 159 B |
|
Before Width: | Height: | Size: 160 B |
|
Before Width: | Height: | Size: 174 B |
|
Before Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 469 B |
|
Before Width: | Height: | Size: 262 B |
|
Before Width: | Height: | Size: 266 B |
|
Before Width: | Height: | Size: 740 B |
|
Before Width: | Height: | Size: 823 B |
|
Before Width: | Height: | Size: 495 B |
|
Before Width: | Height: | Size: 749 B |
|
Before Width: | Height: | Size: 660 B |
|
Before Width: | Height: | Size: 629 B |
|
Before Width: | Height: | Size: 666 B |
|
Before Width: | Height: | Size: 707 B |
|
Before Width: | Height: | Size: 639 B |
|
Before Width: | Height: | Size: 626 B |
|
Before Width: | Height: | Size: 551 B |
|
Before Width: | Height: | Size: 449 B |
|
Before Width: | Height: | Size: 472 B |
|
Before Width: | Height: | Size: 465 B |
|
Before Width: | Height: | Size: 417 B |
|
Before Width: | Height: | Size: 398 B |
|
Before Width: | Height: | Size: 399 B |
|
Before Width: | Height: | Size: 401 B |
|
Before Width: | Height: | Size: 706 B |
|
Before Width: | Height: | Size: 670 B |
|
Before Width: | Height: | Size: 715 B |
|
Before Width: | Height: | Size: 717 B |
|
Before Width: | Height: | Size: 665 B |
|
Before Width: | Height: | Size: 727 B |
|
Before Width: | Height: | Size: 698 B |
|
Before Width: | Height: | Size: 637 B |
|
Before Width: | Height: | Size: 427 B |
|
Before Width: | Height: | Size: 592 B |
|
Before Width: | Height: | Size: 466 B |
|
Before Width: | Height: | Size: 576 B |
|
Before Width: | Height: | Size: 695 B |
|
Before Width: | Height: | Size: 671 B |
|
Before Width: | Height: | Size: 193 B |
|
Before Width: | Height: | Size: 713 B |