Skip to content

Commit 1c98497

Browse files
authoredNov 20, 2021
Merge pull request #33 from dscho/update-screenshots
Update screenshots
2 parents 2dd628e + 8adbf01 commit 1c98497

9 files changed

+666
-0
lines changed
 

‎create-screenshot-thumbnails.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const fs = require('fs')
2+
const jimp = require('jimp')
3+
4+
const generateThumbnail = async (inputPath, width, height, outputPath) => {
5+
console.log(`Generating ${outputPath}`)
6+
const image = await jimp.read(inputPath)
7+
image.resize(width, height).write(outputPath)
8+
}
9+
10+
(async () => {
11+
for (const file of await fs.promises.readdir('img/')) {
12+
const match = file.match(/^(gw\d+)\.png$/)
13+
if (match) {
14+
await generateThumbnail(`img/${match[1]}.png`, 315, 239, `img/${match[1]}web_thumb.png`)
15+
}
16+
}
17+
})().catch(console.log)

‎img/gw1.png

42.5 KB
Loading

‎img/gw1web_thumb.png

-32.9 KB
Loading

‎img/gw2.png

229 KB
Loading

‎img/gw2web_thumb.png

-10.1 KB
Loading

‎img/gw3.png

198 KB
Loading

‎img/gw3web_thumb.png

20.6 KB
Loading

‎package-lock.json

+646
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+3
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,8 @@
3030
},
3131
"engines": {
3232
"node": ">=0.8.0"
33+
},
34+
"devDependencies": {
35+
"jimp": "^0.16.1"
3336
}
3437
}

0 commit comments

Comments
 (0)
Please sign in to comment.