Skip to content

Instantly share code, notes, and snippets.

@SushilShrestha
Last active August 25, 2017 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SushilShrestha/1811def15fab0d15192eb73e333801b9 to your computer and use it in GitHub Desktop.
Save SushilShrestha/1811def15fab0d15192eb73e333801b9 to your computer and use it in GitHub Desktop.
PP and auto size tile photo using imagemagick for a4 size printing

Usage

ppauto inputfilename

Requirements

Imagemagick

Sample

Input File

Input File

Output File

Output File

#!/bin/bash
#--------------------------------------
# A4 size image full of PP and auto size photo tiles
# Usage: ppauto input_file
#
# Requires: imagemagick
usage() {
echo "Usage: ppauto input_file"
}
input_file=$1
output_file="ppauto_$input_file"
if [ -f "$input_file" ]
then
# a single row of pp size photo
montage -density 300 -tile 5x0 -geometry 366x450\^+5+10 $input_file +clone +clone +clone +clone "temp_pp_row$input_file";
# full grid of PP size photoes
montage -density 300 -tile 0x7 -geometry +0+0 "temp_pp_row$input_file" +clone +clone +clone +clone +clone +clone "temp_final_pp_grid$input_file";
# a column of auto size photo
montage -density 300 -tile 0x9 -geometry 295x331\^+7+14 $input_file +clone +clone +clone +clone +clone +clone +clone +clone "temp_final_auto_grid$input_file";
# merge full PP grid and the column auto
convert "temp_final_pp_grid$input_file" "temp_final_auto_grid$input_file" +append $output_file;
rm "temp_pp_row$input_file" "temp_final_pp_grid$input_file" "temp_final_auto_grid$input_file";
else
usage
echo "Couldn't find file $input_file";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment