feat(run): add thumbnails:generate task

This commit is contained in:
Oliver Davies 2023-10-20 00:32:58 +02:00
parent d55df5ca18
commit 3279719cfe
3 changed files with 27 additions and 4 deletions

3
.gitignore vendored
View file

@ -4,7 +4,8 @@
# rst2df. # rst2df.
/**/*.pdf /**/*.pdf
/**/*.rst.build_temp /**/*.rst.build_temp
/dist/*.pdf /dist/*
!/dist/.keep
# pdfpc. # pdfpc.
/**/*.pdfpc /**/*.pdfpc

View file

@ -13,6 +13,7 @@
devshells.default = { devshells.default = {
packages = with pkgs; [ packages = with pkgs; [
ghostscript
pdfpc pdfpc
python310Packages.rst2pdf python310Packages.rst2pdf
tree tree

27
run
View file

@ -48,9 +48,30 @@ function pdf:present {
pdfpc "${@}" "dist/${TALK_PATH}.pdf" --switch-screens pdfpc "${@}" "dist/${TALK_PATH}.pdf" --switch-screens
} }
function thumbnail:generate { # Generate JPG thumbnails of each slide in a presentation.
# Generate a thumbnail image of the first slide in the presentation. function thumbnails:generate {
echo "TODO: thumbnail:generate" if [ "${1}" == "" ]; then
echo "Usage: ./${0##*/} ${FUNCNAME[0]} <talk-name>"
exit 1
fi
if [ ! -d "src/${1}" ]; then
echo "${1} not found"
exit 2
fi
pdf:generate "${1}"
mkdir -p "dist/${1}"
gs \
-dBATCH \
-dDownScaleFactor=3 \
-dNOPAUSE \
-r600 \
-sDEVICE=jpeg \
-sOutputFile="dist/${1}/%d.jpg" \
"dist/${1}.pdf"
} }
TIMEFORMAT=$'\nTask completed in %3lR' TIMEFORMAT=$'\nTask completed in %3lR'