New updated version of the script. Changes are:

- It can now handle jpg and tif (even if tif is probably the best for
printing).

- The tool to open is not hard-coded anymore and can be configured via
the lua preferences.

Pascal.

-- 
  Pascal Obry /  Magny Les Hameaux (78)

  The best way to travel is by means of imagination

  http://v2p.fr.eu.org
  http://www.obry.net

  gpg --keyserver keys.gnupg.net --recv-key F949BD3B
dt = require "darktable"

-- the preference

dt.preferences.register
   ("icc-export","ICC Profile",
    "string","The pathname to the ICC profile to use",
    "This must be an absolute path",
    "~/Images/dt-icc-export.icc")

dt.preferences.register
   ("icc-export","Open with","string",
    "Tool to open the final image",
    "Can be an absolute pathname or the tool may be in the PATH",
    "eog")

function store_callback(storage,image,format,filename,num,total,high_quality,extra_data)
   -- the profile
   iccprof = dt.preferences.read("icc-export","ICC Profile","string")
   -- tool to view the image
   openwith = dt.preferences.read("icc-export","Open with","string")

   -- prefix the output file basename with "icc_"
   iccfile=string.gsub(filename, "(.*/)(.*)", "%1icc_%2")

   -- call either tificc or jpgicc depending on the image format

   if string.match(filename,"%.tif$") == nil then
      tool="jpgicc"
   else
      tool="tificc"
   end

   command = tool.." -o \""..iccprof.."\" -t0 "..filename.." "..iccfile
   os.execute(command)
   os.remove(filename)

   command = openwith.." "..iccfile
   os.execute(command)
   os.remove(iccfile)
end

dt.register_storage("module_print","View with Profile",store_callback,nil)
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
darktable-devel mailing list
darktable-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/darktable-devel

Reply via email to