3 lines
808 B
JavaScript

const sharp=require('../../PlotLine.Tests/Browser/node_modules/sharp'),fs=require('fs'),path=require('path');const masters=path.resolve(__dirname,'../../Docs/PublicMarketingScreenshots/Masters'),root=path.resolve(__dirname,'../../PlotLine/wwwroot/images/public/application');fs.mkdirSync(root,{recursive:true});(async()=>{const specs=JSON.parse(fs.readFileSync(path.resolve(masters,'../Captures.json')));for(const spec of specs){for(const width of [640,960,1280]){await sharp(masters+'/'+spec.asset+'.png').resize({width}).avif({quality:55,effort:6}).toFile(root+'/'+spec.asset+'-'+width+'.avif');await sharp(masters+'/'+spec.asset+'.png').resize({width}).webp({quality:82,effort:6}).toFile(root+'/'+spec.asset+'-'+width+'.webp');}}
console.log('Encoded',specs.length,'approved public captures/crops');})();