Skip to content

Instantly share code, notes, and snippets.

View resetius's full-sized avatar

Alexey Ozeritskiy resetius

View GitHub Profile
@resetius
resetius / process-vga-pallette.php
Created October 3, 2023 22:35 — forked from cesarmiquel/process-vga-pallette.php
VGA 256 Color Palette to RGB
<?php
$im = imagecreatefrompng("vga-palette.png");
$sx = (int) 800 / 16;
$sy = (int) 800 / 16;
$ox = (int) ($sx / 2);
$oy = (int) ($sx / 2);
for($y = 0; $y < 16; $y++) {
for($x = 0; $x < 16; $x++) {
$rgb = imagecolorat($im, $sx*$x + $ox, $sy*$y + $oy);