feat: add page preview baker

This commit is contained in:
Sven Vogel 2024-11-30 18:15:30 +01:00
parent 86e5944390
commit 4513d993b4
3 changed files with 41 additions and 1 deletions

34
baker/preview.typ Normal file
View File

@ -0,0 +1,34 @@
#let gap = 0.5cm
#set page(margin: 0pt, width: 210mm * 3 + 2 * gap, height: 297mm * 2 + gap, fill: rgb(0, 0, 0, 0))
#place(
dx: 0mm,
dy: 0mm,
image("./images/11.svg", height: 297mm))
#place(
dx: 210mm + gap,
dy: 0mm,
image("./images/21.svg", height: 297mm))
#place(
dx: (210mm + gap) * 2,
dy: 0mm,
image("./images/31.svg", height: 297mm))
#place(
dx: 210mm * 0,
dy: 297mm + gap,
image("./images/71.svg", height: 297mm))
#place(
dx: (210mm + gap) * 1,
dy: 297mm + gap,
image("./images/41.svg", height: 297mm))
#place(
dx: (210mm + gap) * 2,
dy: 297mm + gap,
image("./images/51.svg", height: 297mm))

View File

@ -1,12 +1,18 @@
#!/bin/bash
echo "==> generate images"
mkdir images || true
# extract images from document created by action
mutool convert -o images/1.svg "$1" 1
mutool convert -o images/2.svg "$1" 2
mutool convert -o images/2.svg "$1" 2
mutool convert -o images/3.svg "$1" 5
mutool convert -o images/7.svg "$1" 7
mutool convert -o images/4.svg "$1" 15
mutool convert -o images/5.svg "$1" 16
echo "==> generate banner"
typst compile banner.typ --ppi 360 ../assets/banner.png
echo "==> generate preview"
typst compile preview.typ --ppi 360 ../assets/page-preview.png

View File

@ -2,5 +2,5 @@
cd baker
echo "==> generate banner image"
echo "==> generate assets"
nix-shell --run "./run-bake-banner.sh ../example.pdf"