From 37b06789b06ba9697447129f50b26f734a14e3d6 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 24 Mar 2023 12:52:22 -0700 Subject: [PATCH] cleaner handling of reserved colors --- dither-image.js | 6 +++++- video/combine.sh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dither-image.js b/dither-image.js index 1bf07af..422686c 100644 --- a/dither-image.js +++ b/dither-image.js @@ -580,7 +580,11 @@ function decimate(input, palette, n) { // Median cut! // https://en.wikipedia.org/wiki/Median_cut - let buckets = [input.slice()]; + //let buckets = [input.slice()]; + + // preface the reserved bits + let buckets = reserved.slice().map((c) => [atariRGB[c]]).concat([input.slice()]); + let medianCut = (bucket, range) => { if (bucket.length < 2) { console.log(bucket); diff --git a/video/combine.sh b/video/combine.sh index cc81874..e56e0e5 100644 --- a/video/combine.sh +++ b/video/combine.sh @@ -4,6 +4,6 @@ ffmpeg \ -i 'colamath-audio.wav' \ -ac 2 \ -ar 48000 \ - -vf 'pad=w=640:h=480:x=52:y=80' \ + -vf 'pad=w=640:h=360:x=52:y=20' \ -pix_fmt yuv420p \ -y colamath-dither.mp4