17
submitted 5 months ago* (last edited 5 months ago) by django@discuss.tchncs.de to c/unix_surrealism@lemmy.sdf.org

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.

photo of 3 japanese jesus mini-zines

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"

you are viewing a single comment's thread
view the rest of the comments
[-] django@discuss.tchncs.de 2 points 5 months ago

Thanks, i fixed the command detection in my second version. I don't know, if i will find the time to apply the rest to the new version.

[-] tal@lemmy.today 2 points 5 months ago* (last edited 5 months ago)

Sure. No obligation to use it, just throwing it out there if it might be of interest. Also fixed a problem in the patch where I'd modified the patch in the comment without retesting it. Sorry about that.

Thanks for making the script.

this post was submitted on 30 Jun 2026
17 points (100.0% liked)

unix_surrealism

3164 readers
47 users here now

This community is for sharing original content related to computers, content, surrealism and wizardry.

founded 3 years ago
MODERATORS