refacto: Remake the interface so it is more 'vintage' looking + Adding a full calendar page

This commit is contained in:
gauvainboiche
2026-10-25 12:01:00 +01:00
parent 2539b6c756
commit f6738972f1
45 changed files with 1433 additions and 361 deletions
+40
View File
@@ -0,0 +1,40 @@
'use strict';
/**
* Crops the month plates in src/images/ (removes the paper margin, the thin
* frame and the printed caption) and writes web-sized JPGs to
* public/assets/months/<monthKey>.jpg.
*
* Not a project dependency: run with `npm i --no-save sharp && node scripts/prepare-images.cjs`.
*/
const fs = require('node:fs');
const path = require('node:path');
const sharp = require('sharp');
const SRC_DIR = path.join(__dirname, '..', 'src', 'images');
const OUT_DIR = path.join(__dirname, '..', 'public', 'assets', 'months');
// Pixels to remove around the engraving (the scans differ by a few pixels in width).
const CROP = { left: 62, top: 62, right: 66, bottom: 225 };
const OUTPUT_WIDTH = 560;
async function main() {
fs.mkdirSync(OUT_DIR, { recursive: true });
for (const file of fs.readdirSync(SRC_DIR).filter((name) => name.endsWith('.jpg'))) {
const source = path.join(SRC_DIR, file);
const { width, height } = await sharp(source).metadata();
await sharp(source)
.extract({
left: CROP.left,
top: CROP.top,
width: width - CROP.left - CROP.right,
height: height - CROP.top - CROP.bottom,
})
.resize({ width: OUTPUT_WIDTH })
.jpeg({ quality: 80, mozjpeg: true })
.toFile(path.join(OUT_DIR, file.toLowerCase()));
}
}
main();