This script produces an advertising that was published in neural mag. As usual we start by defining some global variables.
TMPDIR=i/tmp LOGODIR=i/free/v/logos/layered/chmod+x_logo_100105/ LOGOLIST=$TMPDIR/vektor.list TEMPTEX=neural.tex PDFDIR=$TMPDIR LAYERS=$TMPDIR/layers.list PDFS=$TMPDIR/pdfs.list OUTPUTDIR=o/free/neuralrm $TMPDIR/*
We use a processing sketch that takes a svg file and draws on the path information given by this file. We define the parameters to execute the processing sketch as usual.
rendering
The chmod+x logo was separated into
layers.
The processing sketch now runs on every file (=layer) in the directory.
The output filenames are unique for each file (=layer) so they can be easily
sorted and rearranged later on. The processing script is called inside a for
–loop,
the input filenames are written into a
textfile which is read by processing.
for PDF in `find $LOGODIR -name "*.svg" | sort` do echo $PDF > $LOGOLIST java -Djava.library.path="$APPDIR" \ -cp "$LIBS" \ chmod_x_shodo4neural_02 done
selecting
Processing has rendered ten different frames for each file/layer and output as pdf file. These pdf files get sorted and referenced in a list.
CNT=0while [ $CNT -lt 10 ] do ls $PDFDIR/*.pdf | \ cut -d "_" -f 1 | \ cut -d "-" -f 1 | \ sort | uniq > $LAYERS rm $PDFS
I wanted layers to be treated different. Some to appear more often,
and for certain layers only certain frames (egrep '0001|00002|00003'
).
IMPORTANTLAYERS="5 6 6 2 2 7 7 7 8 8 8" VIPLAYERS="5 6"COUNT=1 for LAYER in `cat $LAYERS` do ls $LAYER* | \ grep -v 00000 | \ egrep '0001|00002|00003' | \ rl --count=1 >> $PDFSfor L in $IMPORTANTLAYERS; do if [ $COUNT -eq $L ]; thenls $LAYER* | grep -v 00000 | rl --count=2 >> $PDFSfi done for L in $VIPLAYERS; do if [ $COUNT -eq $L ]; thenecho $PDFDIR/99_`find $PDFDIR -name "${LAYER##*/}*" |\ grep 00000 |\ xargs -l basename` >> $PDFSfi done COUNT=`expr $COUNT + 1` done
layouting (=overlaying)
Layouting/Overlaying of pdf-files is done with LaTeX.
Because some of the LaTeX code needs to be generated by a script anyway,
I decided to let the script write the whole tex file. Most of the LaTeX code is static, only a small section is written each time,
because there need different graphic files to be referenced. This is done with a for
–loop.
for PDF in `cat $PDFS | sort | sed 's/99_//'` do echo "\put(0,0){\graphic{"$PDF"}}" >> $TEMPTEX done
This loop produces the following LaTeX Code:
\begin{picture}(0,0) \put(0,0){\graphic{i/tmp/143759--00002.pdf}} \put(0,0){\graphic{i/tmp/143831--00002.pdf}} \put(0,0){\graphic{i/tmp/143831--00003.pdf}} \put(0,0){\graphic{i/tmp/143831--00007.pdf}} \put(0,0){\graphic{i/tmp/143831--00009.pdf}} \put(0,0){\graphic{i/tmp/143831--00010.pdf}} \put(0,0){\graphic{i/tmp/143911--00003.pdf}} \put(0,0){\graphic{i/tmp/144009--00002.pdf}} \put(0,0){\graphic{i/tmp/144045--00002.pdf}} \put(0,0){\graphic{i/tmp/144045--00002.pdf}} \put(0,0){\graphic{i/tmp/144045--00004.pdf}} \put(0,0){\graphic{i/tmp/144118--00004.pdf}} \put(0,0){\graphic{i/tmp/144118--00005.pdf}} \put(0,0){\graphic{i/tmp/144118--00008.pdf}} \put(0,0){\graphic{i/tmp/144118--00009.pdf}} \put(0,0){\graphic{i/tmp/144118--00010.pdf}} \put(0,0){\graphic{i/tmp/144157--00001.pdf}} \put(0,0){\graphic{i/tmp/144157--00001.pdf}} \put(0,0){\graphic{i/tmp/144157--00003.pdf}} \put(0,0){\graphic{i/tmp/144157--00006.pdf}} \put(0,0){\graphic{i/tmp/144157--00008.pdf}} \put(0,0){\graphic{i/tmp/144157--00009.pdf}} \put(0,0){\graphic{i/tmp/144157--00010.pdf}} \put(0,0){\graphic{i/tmp/144234--00001.pdf}} \put(0,0){\graphic{i/tmp/144234--00001.pdf}} \put(0,0){\graphic{i/tmp/144234--00001.pdf}} \put(0,0){\graphic{i/tmp/144234--00002.pdf}} \put(0,0){\graphic{i/tmp/144234--00009.pdf}} \put(0,0){\graphic{i/tmp/144234--00009.pdf}} \put(0,0){\graphic{i/tmp/144234--00010.pdf}} \put(0,0){\graphic{i/tmp/144045--00000.pdf}} \put(0,0){\graphic{i/tmp/144118--00000.pdf}} \end{picture} \end{document}
Finally the generated LaTeX-file
is compiled with with pdflatex
, given a unique filename and moved to a directory.
UNIQUE=`date +%s` pdflatex -output-directory $OUTPUTDIR $TEMPTEX mv $OUTPUTDIR/${TEMPTEX%%.*}.pdf $OUTPUTDIR/neural--$UNIQUE-$CNT.pdf rm $TEMPTEX CNT=`expr $CNT + 1`doneexit 0;
The script creates 10 different pdfs from which one can be selected according to personal taste.