Just curious, why not inclusion of other formats? I would see this especially useful for raw (since that's all I seem to use). Where is the limitation - latex?

Thanks.



On 2015-05-22 11:09, jeremy rosen wrote:
as I've said earlier, I have a wip version, but I won't be able to provide it to you before tuesday....

stay tuned.

in the mean time, you can have a look at the lua API and documentation in the user-manual

* even better, if you compile DT yourself, go in the build/ subdirectory and run "make darktable-usermanual" to have an up to date API documentation
* you can also go to https://github.com/darktable-org/lua-scripts to see examples of darktable scripts

On Fri, May 22, 2015 at 5:09 PM, Matthias Bodenbinder <matth...@bodenbinder.de> wrote:
Hi,

triggered by a question on the user list I created a lua script which creates a contact sheet (Kontaktabzug) for a set of JPGs. The output is a PDF document. The script uses lualatex to do the job. How do I incorporate that script into darktable?

The script works pretty well on the commandline. You can try it out. It is attached below. Just say

        do_contactsheet.lua /path/to/pictures/*.jpg  /path/to/otherpictures/*.png

This will create a contactsheet.pdf in the current directory. With optional commandline parameters --title and --count you can set a different document title and a different number of pictures per line (default is 4)

What I would like to do is:
        - include it into darktable to excecute it for the current film roll
        - set the title to the name of the film roll
        - retrieve all JPGs/PNGs from the current export directory and create the contactsheet.pdf in that directory
        - call the pdf viewer when the script is finished (how to determine the default pdf viewer?)
        - eventually allow the user to set the "count" parameter to a different value
        - eventually allow the user to set the "title" parameter to a different value


I need some help to get there. I dont know how to retrieve the internal darktable parameters, like the current filmroll, nor do I now how to interact with the user in darktable.

Your advice is appreciated
Matthias

Here is the script:
-------------------

#!/usr/bin/lua
-- do_contactsheet.lua creates a contact sheet (Kontakabzug) for a set of pictures
-- it uses LaTeX to create a PDF document
-- it supports JPG and PNG files
-- (c) Matthias Bodenbinder, May 2015

-- default values
title = "Kontaktabzüge"
thumbs_per_line = 4

-- LaTeX preamble
tex_start="\\documentclass[a4paper,10pt]{article}\
\\usepackage{graphicx}\
\\usepackage{fontspec}\
\\pagestyle{empty}\
\\parindent0pt\
\\parskip1em\
\\usepackage{geometry}\
\\geometry{a4paper,left=5mm,right=5mm, top=5mm, bottom=5mm}\
\\begin{document}"

-- place a thumbnail
function thumbnail(i,f)
        -- i = number of this picture
        -- f = fullpath to picture
        -- remove leading path to retrieve filename
        label = string.gsub(f, ".*/", "")
        -- print thumbnail in minipage
        return "\\begin{minipage}[b]{" .. w .. "\\textwidth}\n" ..
        "  \\includegraphics[width=\\textwidth]{" .. f .. "}\\newline\n" ..
        "  \\centering{\\verb|" .. i .. ": " .. label .. "|}\n" ..
        "\\end{minipage}\n"
end

-- print usage message
function usage()
        print("Usage: " .. arg[0] .. " --title <title> --count <thumbs per line> <pictures jpg/png>")
end

-- main loop

-- check for lualatex and exit if it does not exist
if( not os.execute("which lualatex >/dev/null") )then
        print("lualatex not found. Aborting!")
        os.exit()
end

pictures = ""
pcount = 0
i = 1

-- width of a single picture
w = 1/thumbs_per_line - 0.01;

while i<=#arg do
        if (arg[i] == "--title" or arg[i] == "-t") then
                -- next arg is the title
                title = arg[i+1]
                -- go to next picture
                i=i+2
        elseif (arg[i] == "--count" or arg[i] == "-c") then
                -- next arg is thumbs per line
                thumbs_per_line = arg[i+1]
                -- calculate new picture width
                w = 1/thumbs_per_line - 0.01;
                -- go to next picture
                i=i+2
        elseif (arg[i] == "--help" or arg[i] == "-h") then
                usage()
                os.exit()
        else
                pcount=pcount+1;
                pictures = pictures .. thumbnail(pcount, arg[i])
                i=i+1
                if( pcount % thumbs_per_line == 0 ) then
                        -- enough pictures in one line =>
                        pictures = pictures .. "\\par\n"
                else
                        pictures = pictures .. "\\hspace{1mm}\n"
                end
        end
end

-- write tex file to /tmp
basefile = "/tmp/contactsheet"
texfile = basefile .. ".tex"
pdffile = basefile .. ".pdf"

f = io.output(texfile, "w")
io.write(tex_start)
io.write("{\\Large\\bfseries " .. title .. "}\\par\n")
io.write(pictures)
io.write("\\end{document}")
io.close()

-- execute lualatex to create pdf file
os.execute("cd /tmp; lualatex " .. texfile)

-- move pdf to current folder
if( not os.execute("mv " .. pdffile .. " .") ) then
        print("file does not exist: " .. pdffile)
end













------------------------------------------------------------------------------
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-devel mailing list
darktable-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/darktable-devel



------------------------------------------------------------------------------
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-devel mailing list
darktable-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/darktable-devel



------------------------------------------------------------------------------
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-devel mailing list
darktable-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/darktable-devel

Reply via email to