Added saturation and snowglob generators

main
Keir Finlow-Bates 2 years ago
parent 1ad845b3fa
commit 51e3baf2cf

@ -0,0 +1,51 @@
const Jimp = require("jimp")
let base, bottom, middle, top
async function generateGlob(hue) {
const constructed = await base
.clone()
.composite(
bottom.clone().color([
{apply: 'hue', params: [hue]}
]),
0,
0,
{ mode: Jimp.BLEND_SOURCE_OVER }
)
.composite(
middle.clone().color([
{apply: 'hue', params: [hue]}
]),
0,
0,
{ mode: Jimp.BLEND_SOURCE_OVER }
)
.composite(
top.clone().color([
{apply: 'hue', params: [hue]}
]),
0,
0,
{ mode: Jimp.BLEND_SOURCE_OVER }
)
return constructed
}
async function main() {
base = await Jimp.read('./web/public/img/base.png')
bottom = await Jimp.read('./web/public/img/bottom.png')
middle = await Jimp.read('./web/public/img/middle.png')
top = await Jimp.read('./web/public/img/top.png')
for (let i=0; i<1800; i++) {
if ( i%100 === 0) {
process.stdout.write('x')
} else { process.stdout.write('.') }
const hue = i/5
const result = await generateGlob(hue)
await result.write('./allGlobs/' + i + '.png')
}
}
main()

@ -23,6 +23,7 @@
"packageManager": "yarn@3.6.1",
"dependencies": {
"browserify-zlib": "^0.2.0",
"color-convert": "^2.0.1",
"https-browserify": "^1.0.0",
"jimp": "^0.16.2",
"js-file-download": "^0.4.12",

@ -0,0 +1,52 @@
const Jimp = require("jimp")
let base, bottom, middle, top
async function generateGlob(hue, satBoost) {
const constructed = await base
.clone()
.composite(
bottom.clone().color([
{apply: 'hue', params: [hue]}, {apply: 'saturate', params: [satBoost]}
]),
0,
0,
{ mode: Jimp.BLEND_SOURCE_OVER }
)
.composite(
middle.clone().color([
{apply: 'hue', params: [hue]}, {apply: 'saturate', params: [satBoost]}
]),
0,
0,
{ mode: Jimp.BLEND_SOURCE_OVER }
)
.composite(
top.clone().color([
{apply: 'hue', params: [hue]}, {apply: 'saturate', params: [satBoost]}
]),
0,
0,
{ mode: Jimp.BLEND_SOURCE_OVER }
)
return constructed
}
async function main() {
base = await Jimp.read('./web/public/img/base.png')
bottom = await Jimp.read('./web/public/img/bottom.png')
middle = await Jimp.read('./web/public/img/middle.png')
top = await Jimp.read('./web/public/img/top.png')
for (let i=0; i<1800; i++) {
if ( i%100 === 0) {
process.stdout.write('x')
} else { process.stdout.write('.') }
const hue = i/5
const satBoost = i % 100
const result = await generateGlob(hue,satBoost)
await result.write('./allGlobs/' + i + '.png')
}
}
main()

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save