Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
zoey-lin-generating-photos-with-code [2023/06/07 20:05] zoey.linzoey-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#code|Programming Code]]
  
 {{:zoey-third-images-with-jimp-1.jpg?400|}} {{:zoey-third-images-with-jimp-1.jpg?400|}}
Line 47: Line 49:
 {{:zoey-flower-test-added-12.jpg?400|}} {{:zoey-flower-test-added-12.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>
  • zoey-lin-generating-photos-with-code.1686193537.txt.gz
  • Last modified: 2023/06/07 20:05
  • by zoey.lin