From 4513d993b4de65af9935cf4056adb71e2e634d68 Mon Sep 17 00:00:00 2001 From: servostar Date: Sat, 30 Nov 2024 18:15:30 +0100 Subject: [PATCH] feat: add page preview baker --- baker/preview.typ | 34 ++++++++++++++++++++++++++++++++++ baker/run-bake-banner.sh | 6 ++++++ run-bake-assets.sh | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 baker/preview.typ diff --git a/baker/preview.typ b/baker/preview.typ new file mode 100644 index 0000000..cacc374 --- /dev/null +++ b/baker/preview.typ @@ -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)) diff --git a/baker/run-bake-banner.sh b/baker/run-bake-banner.sh index de163b3..5dc1bc2 100755 --- a/baker/run-bake-banner.sh +++ b/baker/run-bake-banner.sh @@ -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 diff --git a/run-bake-assets.sh b/run-bake-assets.sh index 1157760..41f4315 100755 --- a/run-bake-assets.sh +++ b/run-bake-assets.sh @@ -2,5 +2,5 @@ cd baker -echo "==> generate banner image" +echo "==> generate assets" nix-shell --run "./run-bake-banner.sh ../example.pdf"