#!/bin/sh
#*********************************************************************#
#                                                                     #
#                             Active-DVI                              #
#                                                                     #
#                   Projet Cristal, INRIA Rocquencourt                #
#                                                                     #
#  Copyright 2003 Institut National de Recherche en Informatique et   #
#  en Automatique.  All rights reserved.  This file is distributed    #
#  under the terms of the GNU Lesser General Public License.          #
#                                                                     #
#  Jun Furuse, Didier Rémy and Pierre Weis.                           #
#  Contributions by Roberto Di Cosmo, Didier Le Botlan,               #
#  Xavier Leroy, and Alan Schmitt.                                    #
#                                                                     #
#  Based on Mldvi by Alexandre Miquel.                                #
#*********************************************************************#

# $Id: mkfrise,v 1.1 2003/10/22 16:51:30 weis Exp $
# Pierre Weis

# Command to generate the frise image of thumbnails

# Finding images to include in the frise
BASICSIMGS=`find basics -name '*.png'`
JAPANESEIMGS=`find japanese -name '*.png'`
PROSPERIMGS=`find prosper -name '*.png'`
SEMINARIMGS=`find seminar -name '*.png'`
SLITEXIMGS=`find slitex -name '*.png'`
TESTIMGS=`find test -name '*.png'`

#echo Basics images
#echo $BASICSIMGS
#echo
#echo Japanese images
#echo $JAPANESEIMGS
#echo
#echo Prosper images
#echo $PROSPERIMGS
#echo
#echo Seminar images
#echo $SEMINARIMGS
#echo
#echo Slitex images
#echo $SLITEXIMGS
#echo
#echo Test images
#echo $TESTIMGS

IMGS="$BASICSIMGS $JAPANESEIMGS $PROSPERIMGS $SEMINARIMGS $SLITEXIMGS $TESTIMGS"

#echo Images
#echo
#echo $IMGS
#echo

# The size of individual image in the resulting frise
HEIGHT=85
WIDTH=115

#echo $HEIGHT

echo Resizing source images
echo
for i in $IMGS;
do
  j=`basename $i`; \
  echo Converting $i to thumb_`basename $j`; \
  convert -geometry ${WIDTH}x${HEIGHT}! $i thumb_$j
done

echo
echo Joining images
echo Upper frise
montage -tile 1600x$HEIGHT -mode Concatenate -background white -adjoin \
thumb_LL*.png thumb_O*.png thumb_a*.png uf.png
echo Center frise
montage -tile 1600x$HEIGHT -mode Concatenate -background white -adjoin \
thumb_b*.png thumb_c*.png thumb_d*.png thumb_i*.png thumb_j*.png cf.png
echo Lower frise
montage -tile 1600x$HEIGHT -mode Concatenate -background white -adjoin \
thumb_m*.png thumb_p*.png thumb_s*.png thumb_t*.png thumb_y*.png lf.png

echo Making final montage

HHEIGHT=85
HWIDTH=1600

montage -tile 1x3 -geometry ${HWIDTH}x$HHEIGHT! uf.png cf.png lf.png bigf.png

echo Making frise f.png

convert -geometry 800x150! bigf.png f.png

echo Clean up

rm -f thumb_*
rm -f uf.png
rm -f cf.png
rm -f lf.png
rm -f bigf.png

