Chris --- this is a very basic script (it can get infinitely more 
complex, but you get the idea). It's written in python3, and you use it 
saying `do_album *.jpg` in the directory where all your jpegs are. It 
will put three images per line, with the name below; the created file is 
`album.tex` and you can compile it with `pdflatex album`.

It does not handle rotation nor fancy things --- it's just a basic one 
to build upon.

Hope this helps,

      Romano

#***********cut here****************
#! /usr/bin/env python3
# -*- coding: utf8 -*-
#
import sys
import os
import re
import argparse

fixed_preamble = r"""
\documentclass[10pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{times}
\pagestyle{empty}
\newcommand{\putfoto}[2]{\begin{tabular*}{0.33\linewidth}[t]{p{0.3\linewidth}}
{\centering \includegraphics[width=.9\linewidth]{#1} \par} \\
{\centering\sloppy {\scriptsize #2} \par}
\end{tabular*}
   }
\parindent=0pt
\begin{document}
"""

fixed_end = r"""
\end{document}
"""
# description
parser = argparse.ArgumentParser(description="create a photo album")
# two  positional (mandatory) argument
# a variable number of string arguments
parser.add_argument('imgs', metavar='imgs', nargs="+", # at least one arg
                    help='image, [image, [...]]')

args=parser.parse_args()
print("imgs", args.imgs)
# open (and destroy if it existed) the output file
f = open("album.tex", mode="w", encoding="utf-8")
f.write(fixed_preamble)
for img in args.imgs:
     # input the graphic file and the name
     f.write("\\putfoto{%s}{%s}\n" % (img, img))
f.write(fixed_end)
#********cut here************



On 20/05/15 10:50, chris wrote:
> hi Romano,
>
> if you could share your script that populates filenames in latex file,
> it would be great.
>
> thanks,
> Chirs



-- 
--
Romano Giannetti
http://www.rgtti.com/

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Darktable-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/darktable-users

Reply via email to