Files
Adminator 1e51ef7def Nachtrag: alle bisher untracked Ordner + hängende Änderungen mit-committen
- Konzept/, didaktik_geografie/, didaktik_simulation/, v2-modules/, v2-platform/
- 12 code-workspace-Files
- STATUS-*.md
- viele M/D/R-Änderungen an bereits getrackten Files
- .gitignore verstärkt: **/.humaninput/, **/secret_keys.txt

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-07-08 02:27:02 +02:00

57 lines
1.9 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Erzeugt eine kontrast-/sättigungs-verstärkte Variante der Erd-Textur.
* Aufruf: c:\xampp\php\php.exe enhance-earth-texture.php
*
* Quelle: assets/img/earth-equirect.jpg (NASA Blue Marble, 2048×1024)
* Ziel: assets/img/earth-equirect-hi.jpg (Kontrast +, Sättigung +)
*
* Hintergrund: Die NASA-Karte ist relativ flau (gemittelte Satellitendaten),
* auf einer 3D-Sphere wirkt sie schnell grau. Wir heben Kontrast und Sättigung,
* lassen die Helligkeit bei.
*/
$srcPath = __DIR__ . '/../assets/img/earth-equirect.jpg';
$dstPath = __DIR__ . '/../assets/img/earth-equirect-hi.jpg';
if (!is_file($srcPath)) {
fwrite(STDERR, "Source missing: $srcPath\n");
exit(1);
}
$img = imagecreatefromjpeg($srcPath);
$w = imagesx($img); $h = imagesy($img);
// 1) Kontrast erhöhen (negative Werte = mehr Kontrast in PHP-GD)
imagefilter($img, IMG_FILTER_CONTRAST, -28);
// 2) Sättigung erhöhen — PHP-GD hat keinen direkten Saturation-Filter,
// also pixel-by-pixel über HSL. Faktor 1.35 = 35 % saturierter.
$satBoost = 1.35;
for ($y = 0; $y < $h; $y++) {
for ($x = 0; $x < $w; $x++) {
$rgb = imagecolorat($img, $x, $y);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
// Luma + Sättigungs-Boost (nähern HSL-Verhalten an)
$luma = 0.2126 * $r + 0.7152 * $g + 0.0722 * $b;
$r = max(0, min(255, (int)($luma + ($r - $luma) * $satBoost)));
$g = max(0, min(255, (int)($luma + ($g - $luma) * $satBoost)));
$b = max(0, min(255, (int)($luma + ($b - $luma) * $satBoost)));
imagesetpixel($img, $x, $y, ($r << 16) | ($g << 8) | $b);
}
}
// 3) Leichtes Schärfen
$sharpen = [
[ 0, -1, 0],
[-1, 6, -1],
[ 0, -1, 0],
];
imageconvolution($img, $sharpen, 2, 0); // div=2, offset=0
imagejpeg($img, $dstPath, 92);
imagedestroy($img);
echo "OK: $dstPath (" . round(filesize($dstPath)/1024) . " KB)\n";