Add scripts to color-reduce pictures with constraints

Scripts for various Thomson machines, Oric and ZX. All the hard work of
Samuel Devulder, with extensive research on color palette reduction
algorithms, lots of testing, research and debugging.

Thanks a lot!
This commit is contained in:
Adrien Destugues
2017-03-21 21:48:39 +01:00
parent 32b3996cb8
commit f4bfaeca89
18 changed files with 3274 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
-- ostro_mo5.lua : converts a color image into a
-- MO5 image (16 fixed colors with color clash)
-- using Ostromoukhov's error diffusion algorithm.
--
-- Version: 02-jan-2017
--
-- Copyright 2016-2017 by Samuel Devulder
--
-- This program is free software; you can redistribute
-- it and/or modify it under the terms of the GNU
-- General Public License as published by the Free
-- Software Foundation; version 2 of the License.
-- See <http://www.gnu.org/licenses/>
run('lib/ostromoukhov.lua')
local dith=OstroDither:new()
local tmp=dith.setLevelsFromPalette
dith.setLevelsFromPalette = function(self)
tmp(self)
self.attenuation=0
end
dith:dither40cols(function(w,h,getLinearPixel)
local pal={}
for i=0,15 do pal[i+1] = thomson.palette(i) end
return pal
end)