Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
zoey-lin-generating-photos-with-code [2023/06/07 20:05] – zoey.lin | zoey-lin-generating-photos-with-code [2023/06/07 20:36] (current) – zoey.lin | ||
---|---|---|---|
Line 2: | Line 2: | ||
Made by: [[zoey-lin|Zoey]] | Made by: [[zoey-lin|Zoey]] | ||
+ | |||
+ | * [[zoey-lin-generating-photos-with-code# | ||
{{: | {{: | ||
Line 47: | Line 49: | ||
{{: | {{: | ||
+ | ====Code==== | ||
+ | < | ||
+ | var Jimp = require(" | ||
+ | |||
+ | let photoPaths = [ | ||
+ | //" | ||
+ | " | ||
+ | //" | ||
+ | " | ||
+ | " | ||
+ | |||
+ | ]; | ||
+ | |||
+ | let jimpData = photoPaths.map(path => Jimp.read(path)); | ||
+ | |||
+ | Promise.all(jimpData).then ((photo) => { | ||
+ | return | ||
+ | //.mirror( false, true ) | ||
+ | // | ||
+ | .composite(photo[1], | ||
+ | //.mirror( true, true ) | ||
+ | // | ||
+ | .composite(photo[2], | ||
+ | // | ||
+ | .write(" | ||
+ | }).catch((err) => {console.error(err)}) | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | var Jimp = require(" | ||
+ | |||
+ | let photoPaths = [ | ||
+ | //" | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | //" | ||
+ | |||
+ | ]; | ||
+ | |||
+ | let jimpData = photoPaths.map(path => Jimp.read(path)); | ||
+ | |||
+ | Promise.all(jimpData).then ((photo) => { | ||
+ | return | ||
+ | //.mirror( false, true ) | ||
+ | // | ||
+ | .composite(photo[1], | ||
+ | .mirror( true, false ) | ||
+ | .contrast(0.2) | ||
+ | .dither565() | ||
+ | .sepia() | ||
+ | .composite(photo[2], | ||
+ | // | ||
+ | .invert() | ||
+ | // | ||
+ | .resize(2000, | ||
+ | .write(" | ||
+ | }).catch((err) => {console.error(err)}) | ||
+ | </ |