I'm writing some code that automatically exports TeX for context to convert into a report. The content that this code manipulates includes images in .dng format. While I'm aware that I can add an extra step convert foo.dng foo.pdf as a shell command, this will almost double (to 20 gigs) the size of the tarballs we're throwing around.

Is there a way to use a module or other means to losslessly convert (I briefly looked at dng -> jbig, but that didn't seem to work) images for final inclusion into the document?

  • luatex/pdftex can only include jpeg (including jbig), png, pdf, and a restricted version of eps files. So, you'll have to convert dng to one of these. The conversion to jpeg/png will be lossy; when you convert to pdf, you loose the compression features of dng. So, you'll have to choose your pick. – Aditya Jan 20 '15 at 3:43
  • Well, right now I'm converting to PDF, but the main question is how to invoke that conversion via lua, since it's not done automagically. – Brian Ballsun-Stanton Jan 20 '15 at 3:46

You can convert the DNG files inplace when doing \externalfigure. You only have to register a converter on the Lua level. Of course you need to have the required external programs ready.

figures.converters.dng.pdf = function(oldname,newname,resolution)
    logs.report("graphics","using imagemagick to convert " .. oldname)
    os.execute("convert " .. oldname .. " " .. newname)




When run this will generate a file m_k_i_v_foo.dng.pdf.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.