I tried to make foldable mini-zines from the japanese jesus comic: https://files.catbox.moe/9e0inu.pdf These can be printed on 3 sheets of paper and folded like so: https://slrpnk.net/post/9615309 Sadly, due to page count constraints, i could not put the cover on the third part when keeping all pages as is.

There are two alternative versions available:
In both something is missing, choose your favorite.
They were created using the following script, which you should run in a empty directory:
First Version
#!/bin/sh
# create 3-part mini zine from japanese jesus
check () {
if [ "$(which $1 2>/dev/null)" == "" ];
then
echo "ERROR: missing $1 utility"
exit 1
fi
}
echo "checking required tools"
check magick
check pdfjam
check pdfcrop
check wget
rotate () {
magick convert -rotate -90 $1 $1.tmp.png
mv $1.tmp.png $1
}
if [ ! -f 000_jjc.png ];then
echo "downloading source files"
wget https://img.triapul.cz/jjc.png -O 000_jjc.png
wget https://img.triapul.cz/christmas.png -O 001_christmas.png
wget https://img.triapul.cz/jordan_cold_cock.png -O 002_jordan_cold_cock.png
wget https://img.triapul.cz/40days1.png -O 003_40days1.png
wget https://img.triapul.cz/40days2.png -O 004_40days2.png
wget https://img.triapul.cz/third_oni.png -O 005_third_oni.png
wget https://img.triapul.cz/herod.png -O 006_herod.png
wget https://img.triapul.cz/mount_8.png -O 007_mount_8.png
wget https://img.triapul.cz/lazarus1.png -O 008_lazarus1.png
wget https://img.triapul.cz/danbrown.png -O 009_danbrown.png
wget https://img.triapul.cz/thread_the_needle.png -O 010_thread_the_needle.png
wget https://img.triapul.cz/thread_the_needle_2.png -O 011_thread_the_needle_2.png
wget https://img.triapul.cz/dirtydozen1.png -O 012_dirtydozen1.png
wget https://img.triapul.cz/dirtydozen2.png -O 013_dirtydozen2.png
wget https://img.triapul.cz/gethsemane.png -O 014_gethsemane.png
wget https://img.triapul.cz/pleased_to_meet_you.png -O 015_pleased_to_meet_you.png
wget https://img.triapul.cz/mrs_robinson.png -O 016_mrs_robinson.png
wget https://img.triapul.cz/vickers.png -O 017_vickers.png
wget https://img.triapul.cz/calvary.png -O 018_calvary.png
wget https://img.triapul.cz/judas.png -O 019_judas.png
wget https://img.triapul.cz/ghost_in_training.png -O 020_ghost_in_training.png
wget https://img.triapul.cz/fossberg.png -O 021_fossberg.png
wget https://img.triapul.cz/constantine.png -O 022_constantine.png
echo "rotating images"
rotate 011*.png
rotate 012*.png
rotate 013*.png
fi
create_part () {
pdfjam $2 $3 $4 $5 $6 $7 $8 $9 --a4paper --width 20cm --outfile part$1_tmp1.pdf --delta '1cm 1cm'
pdfjam part$1_tmp1.pdf 8,7,1,6,2,5,3,4 --a4paper --otheredge --outfile part$1_tmp2.pdf
pdfjam part$1_tmp2.pdf --a4paper --nup 2x4 --angle 90 --outfile part$1_tmp3.pdf
pdfcrop part$1_tmp3.pdf part$1_tmp4.pdf
pdfjam part$1_tmp4.pdf --a4paper --trim '-0.5cm -0.5cm -0.5cm -0.5cm' --outfile part$1_tmp5.pdf
pdfjam part$1_tmp5.pdf --a4paper --outfile part$1.pdf
}
create_cover () {
magick convert -gravity NorthWest -pointsize 40 -undercolor white -annotate +0+0 'japanese jesus — part '$2' || https://triapul.cz/' $1 cover$2.png
}
echo "creating covers"
create_cover 000_jjc.png 1
create_cover 000_jjc.png 2
create_cover 015*.png 3
echo "creating pdf files"
create_part 1 cover1.png $(ls 0*.png|head -n8|tail -n7)
create_part 2 cover2.png $(ls 0*.png|head -n15|tail -n7)
create_part 3 cover3.png $(ls 0*.png|tail -n7)
echo "joining pdf files"
pdfjam part1.pdf part2.pdf part3.pdf --a4paper --outfile japanese_jesus.pdf
echo "cleanup"
rm cover* *tmp*.pdf
rm part*.pdf
echo "all done, enjoy japanese_jesus.pdf"
echo "see https://slrpnk.net/post/9615309 on folding"
Second Version
#!/bin/sh
# create 3-part mini zine from japanese jesus
check () {
if [ -z "$(command -v $1 2>/dev/null)" ];
then
echo "ERROR: missing $1 utility"
exit 1
fi
}
echo "checking required tools"
check magick
check pdfjam
check pdfcrop
check wget
rotate () {
magick convert -rotate -90 $1 $1.tmp.png
mv $1.tmp.png $1
}
join_parts () {
echo "joining pdf files"
pdfjam part1.pdf part2.pdf part3.pdf --a4paper --outfile $1
rm part*.pdf
}
if [ ! -f 000_jjc.png ];then
echo "downloading source files"
wget https://img.triapul.cz/jjc.png -O 000_jjc.png
wget https://img.triapul.cz/christmas.png -O 001_christmas.png
wget https://img.triapul.cz/jordan_cold_cock.png -O 002_jordan_cold_cock.png
wget https://img.triapul.cz/40days1.png -O 003_40days1.png
wget https://img.triapul.cz/40days2.png -O 004_40days2.png
wget https://img.triapul.cz/third_oni.png -O 005_third_oni.png
wget https://img.triapul.cz/herod.png -O 006_herod.png
wget https://img.triapul.cz/mount_8.png -O 007_mount_8.png
wget https://img.triapul.cz/lazarus1.png -O 008_lazarus1.png
wget https://img.triapul.cz/danbrown.png -O 009_danbrown.png
wget https://img.triapul.cz/thread_the_needle.png -O 010_thread_the_needle.png
wget https://img.triapul.cz/thread_the_needle_2.png -O 011_thread_the_needle_2.png
wget https://img.triapul.cz/dirtydozen1.png -O 012_dirtydozen1.png
wget https://img.triapul.cz/dirtydozen2.png -O 013_dirtydozen2.png
wget https://img.triapul.cz/gethsemane.png -O 014_gethsemane.png
wget https://img.triapul.cz/pleased_to_meet_you.png -O 015_pleased_to_meet_you.png
wget https://img.triapul.cz/mrs_robinson.png -O 016_mrs_robinson.png
wget https://img.triapul.cz/vickers.png -O 017_vickers.png
wget https://img.triapul.cz/calvary.png -O 018_calvary.png
wget https://img.triapul.cz/judas.png -O 019_judas.png
wget https://img.triapul.cz/ghost_in_training.png -O 020_ghost_in_training.png
wget https://img.triapul.cz/fossberg.png -O 021_fossberg.png
wget https://img.triapul.cz/constantine.png -O 022_constantine.png
cp 0*dirtydozen1.png dirtydozen1.png
cp 0*dirtydozen2.png dirtydozen2.png
echo "rotating images"
rotate 011*.png
rotate 012*.png
rotate 013*.png
fi
if [ ! -f dirtydozen.png ];then
magick dirtydozen2.png -chop 0x180 dirtydozen2_chopped.png
echo "merging dirty dozen"
magick convert -append dirtydozen1.png dirtydozen2_chopped.png dirtydozen.png
fi
create_part () {
pdfjam $2 $3 $4 $5 $6 $7 $8 $9 --a4paper --width 20cm --outfile part$1_tmp1.pdf --delta '1cm 1cm'
pdfjam part$1_tmp1.pdf 8,7,1,6,2,5,3,4 --a4paper --otheredge --outfile part$1_tmp2.pdf
pdfjam part$1_tmp2.pdf --a4paper --nup 2x4 --angle 90 --outfile part$1_tmp3.pdf
pdfcrop part$1_tmp3.pdf part$1_tmp4.pdf
pdfjam part$1_tmp4.pdf --a4paper --trim '-0.5cm -0.5cm -0.5cm -0.5cm' --outfile part$1_tmp5.pdf
pdfjam part$1_tmp5.pdf --a4paper --outfile part$1.pdf
}
create_cover () {
magick convert -gravity NorthWest -pointsize 40 -undercolor white -annotate +0+0 'japanese jesus — part '$2' || https://triapul.cz/' $1 cover$2.png
}
echo "creating covers"
create_cover 000_jjc.png 1
create_cover 000_jjc.png 2
create_cover 015*.png 3
echo "creating pdf files (1/3)"
create_part 1 cover1.png $(ls 0*.png|head -n8|tail -n7)
create_part 2 cover2.png $(ls 0*.png|head -n15|tail -n7)
create_part 3 cover3.png $(ls 0*.png|tail -n7)
echo "joining pdf files (1/3)"
join_parts japanese_jesus.pdf
echo "creating pdf files (2/3)"
create_cover 000_jjc.png 3
create_part 1 cover1.png $(ls 0*.png|head -n8|tail -n7)
create_part 2 cover2.png $(ls 0*.png|head -n15|tail -n7)
create_part 3 cover3.png $(ls 0*.png|tail -n8|head -n7)
echo "joining pdf files (2/3)"
join_parts japanese_jesus_sans_constantine.pdf
echo "creating pdf files (3/3)"
create_part 1 cover1.png $(ls 0*.png|head -n8|tail -n7)
create_part 2 cover2.png 008*.png 009*.png 010*.png 011*.png dirtydozen.png 014*.png 015*.png
create_part 3 cover3.png $(ls 0*.png|tail -n7)
echo "joining pdf files (3/3)"
join_parts japanese_jesus_merged_dirty_dozen.pdf
echo "cleanup"
rm cover* *tmp*.pdf
echo "all done, enjoy japanese_jesus.pdf"
echo "see https://slrpnk.net/post/9615309 on folding"
neat! heads up though,
whichis not standard posix. userealpathfor portability.You're right that
realpathisn't in POSIX, butrealpathdoesn't do the same thing aswhich. @django@discuss.tchncs.de is usingwhichto search$PATH.He could maybe use
type, which is similar, and is in POSIX.https://pubs.opengroup.org/onlinepubs/9799919799/utilities/type.html
I am switching to
command.doesn't
realpathbehave the same if a program is in$PATH? i thought it errored if it couldn't find a file.Nah. Doesn't look at
$PATHat all.It's for doing things like resolving symlinks, and even then, doesn't require that the target exist:
man, i must have hallucinated that manpage. i can't find it now.
Thanks friend, I'll update it later from my computo.
i mean, considering you need a bunch of tools installed anyway it's probably not a big deal. not like someone is gonna run this on their headless storage vm running openindiana or anything.
why do you have to single me out like that?
You can just download the pdf. ;-)