| Next revision | Previous revision |
| zoey-lin-generating-photos-with-code [2023/06/07 20:00] – created zoey.lin | zoey-lin-generating-photos-with-code [2023/06/07 20:36] (current) – zoey.lin |
|---|
| |
| Made by: [[zoey-lin|Zoey]] | Made by: [[zoey-lin|Zoey]] |
| | |
| | * [[zoey-lin-generating-photos-with-code#code|Programming Code]] |
| |
| {{:zoey-third-images-with-jimp-1.jpg?400|}} | {{:zoey-third-images-with-jimp-1.jpg?400|}} |
| {{:zoey-third-images-with-jimp-2.jpg?400|}} | |
| {{:zoey-third-images-with-jimp-3.jpg?400|}} | {{:zoey-third-images-with-jimp-3.jpg?400|}} |
| {{:zoey-third-images-with-jimp-4.jpg?400|}} | {{:zoey-third-images-with-jimp-4.jpg?400|}} |
| {{:zoey-third-images-with-jimp-9.jpg?400|}} | {{:zoey-third-images-with-jimp-9.jpg?400|}} |
| {{:zoey-third-images-with-jimp-10.jpg?400|}} | {{:zoey-third-images-with-jimp-10.jpg?400|}} |
| | {{:zoey-third-images-with-jimp-2.jpg?400|}} |
| |
| {{:zoey-second-images-with-jimp-1.jpg?400|}} | {{:zoey-second-images-with-jimp-1.jpg?400|}} |
| {{:zoey-second-images-with-jimp-6.jpg?400|}} | {{:zoey-second-images-with-jimp-6.jpg?400|}} |
| {{:zoey-second-images-with-jimp-7.jpg?400|}} | {{:zoey-second-images-with-jimp-7.jpg?400|}} |
| | |
| | {{:zoey-flower-test-added-18.jpg?400|}} |
| | {{:zoey-flower-test-added-19.jpg?400|}} |
| | {{:zoey-flower-test-added-20.jpg?400|}} |
| | {{:zoey-flower-test-added-21.jpg?400|}} |
| | {{:zoey-flower-test-added-22.jpg?400|}} |
| | {{:zoey-flower-test-added-23.jpg?400|}} |
| | {{:zoey-flower-test-added-24.jpg?400|}} |
| | {{:zoey-flower-test-added-25.jpg?400|}} |
| | {{:zoey-flower-test-added-26.jpg?400|}} |
| | {{:zoey-flower-test-added-27.jpg?400|}} |
| | {{:zoey-flower-test-added-28.jpg?400|}} |
| |
| {{:zoey-flower-test-added-01.jpg?400|}} | {{:zoey-flower-test-added-01.jpg?400|}} |
| {{:zoey-flower-test-added-11.jpg?400|}} | {{:zoey-flower-test-added-11.jpg?400|}} |
| {{:zoey-flower-test-added-12.jpg?400|}} | {{:zoey-flower-test-added-12.jpg?400|}} |
| {{:zoey-flower-test-added-13.jpg?400|}} | |
| {{:zoey-flower-test-added-14.jpg?400|}} | |
| {{:zoey-flower-test-added-15.jpg?400|}} | |
| {{:zoey-flower-test-added-16.jpg?400|}} | |
| {{:zoey-flower-test-added-17.jpg?400|}} | |
| {{:zoey-flower-test-added-18.jpg?400|}} | |
| |
| | ====Code==== |
| | <code> |
| | var Jimp = require("jimp"); |
| | |
| | let photoPaths = [ |
| | //".\\testPhotos\\zoey-balance-in-photography-5.jpg", |
| | ".\\testPhotos\\zoey-photos-leading-lines-5.png", |
| | //".\\testPhotos\\zoey-landscape photos-after-1.jpg", |
| | ".\\testPhotos\\zoey-balance-in-photography-5.jpg", |
| | ".\\testPhotos\\zoey-landscape photos-after-5.jpg", |
| | |
| | ]; |
| | |
| | let jimpData = photoPaths.map(path => Jimp.read(path)); |
| | |
| | Promise.all(jimpData).then ((photo) => { |
| | return photo[0] |
| | //.mirror( false, true ) |
| | //.contrast(0.2) |
| | .composite(photo[1],0,0, {mode:Jimp.BLEND_SCREEN})//Jimp.BLEND_HARDLIGHT |
| | //.mirror( true, true ) |
| | //.contrast(0.2) |
| | .composite(photo[2],0,0, {mode:Jimp.BLEND_EXCLUSION})//Jimp.BLEND_LIGHTEN |
| | //.quality(97) // set JPEG quality |
| | .write(".\\testPhotos\\zoey-second-images-with-JIMP-1.jpg"); |
| | }).catch((err) => {console.error(err)}) |
| | </code> |
| | |
| | <code> |
| | var Jimp = require("jimp"); |
| | |
| | let photoPaths = [ |
| | //".\\testPhotos\\zoey-balance-in-photography-5.jpg", |
| | ".\\testPhotos\\zoey-photography-flower-6.jpg", |
| | ".\\testPhotos\\zoey-landscape photos-after-6.jpg", |
| | ".\\testPhotos\\zoey-balance-in-photography-5.jpg", |
| | //".\\testPhotos\\\zoey-perspective-in-photos-8.jpg", |
| | |
| | ]; |
| | |
| | let jimpData = photoPaths.map(path => Jimp.read(path)); |
| | |
| | Promise.all(jimpData).then ((photo) => { |
| | return photo[0] |
| | //.mirror( false, true ) |
| | //.contrast(0.2) |
| | .composite(photo[1],0,0, {mode:Jimp.BLEND_DIFFERENCE})//Jimp.BLEND_HARDLIGHT |
| | .mirror( true, false ) |
| | .contrast(0.2) |
| | .dither565() |
| | .sepia() |
| | .composite(photo[2],0,0, {mode:Jimp.BLEND_DIFFERENCE})//BLEND_DIFFERENCE |
| | //.quality(97) |
| | .invert() |
| | //.composite(photo[3],0,0, {mode:Jimp.BLEND_HARDLIGHT}) |
| | .resize(2000, 2000) |
| | .write(".\\testPhotos\\zoey-third-images-with-JIMP-3.jpg"); |
| | }).catch((err) => {console.error(err)}) |
| | </code> |