Name, Description and Keywords are not recognized by Shutterstock

Windows, well I’m sitting all day long in front of such a machine, but don’t use it for my RAW images to process.

Anyway, I got it working on Win10 with the attached LUA script.

I did following for installation:

  1. Install exiftool in a place where it can be found if you use the cmd.exe from any place. I copied exiftool.exe into C:\Windows\
  2. in AppData\Local\darktable I made a new folder lua and copied exiftool_export.lua into this folder
  3. created a luarc and added require "exiftool_export" (2.0 KB)

From the original version I removed the checking if the exiftool is installed. I also needed to replace ' with "

Sometimes even a blind chicken …

edit: cmd.exe pops up on every call. That can be a bit annoying I guess …

@pk5dark: Thanks a lot, now LUA is really working:slight_smile:
I can see my tags on Shutterstock after export now, but no description, i need to investigate.

Dam, I forgot to fix that part in the script. So it won’t work with the version above, Sorry. (2.0 KB)

You need to figure out what else need to be copied.

You can try to use the exiftool with an arguments file. An arguments file can have several options over multiple lines. This is the -@ option, which you should be able select from the modul. There is a kind of official but old sample argument file. If you select the -@ option in the modul, you will get a field for file selection. You can try this file:

@pk5dark: You are right, there was just Keywords to Tags mapping in the LUA script.
Can I add mapping for Title without using argument file? I tried to add -XMP-dc:Title > IPTC:ObjectName mapping into LUA script, but it is not working:

cmd_options[1] = “-XMP-dc:Subject > IPTC:Keywords -XMP-dc:Title > IPTC:ObjectName”

@P_Cherry: before fideling with the script, you can try command options directly in the cmd.exe.

I’m not an exiftool expert :smirk:

If I try

exiftool "-XMP-dc:Subject > IPTC:Keywords -XMP-dc:Title > IPTC:ObjectName" image.jpg

in the cmd.exe I got the error message:

Warning: Invalid tag name 'iptc:keywords -xmp-dc:title > iptc:objectname'

I think it would be much easier to use an arg file. Just create a new txt file (XMPtoIPTC.txt) and add arguments line by line like:

-XMP-dc:Subject > IPTC:Keywords
-XMP-dc:Title > IPTC:ObjectName

and then try:

exiftool -@ XMPtoIPTC.txt image.jpg

@pk5dark Could you please test if this “check_if_bin_exists” version works with Windows?

function check_if_bin_exists(bin)
  local result
  if (dt.configuration.running_os == "windows") then
    if f~=nil then 
	  return true 
	  return false 
  elseif (dt.configuration.running_os == "linux") then
    result = os.execute("which " .. bin)
  elseif (dt.configuration.running_os == "macos") then
    result = os.execute() -- ToDo: We need something here
    result = false
  if (not result or result == nil) then
    result = false
  return result


if not check_if_bin_exists("exiftool") then
    dt.print_error("exiftool not found")
	dt.print_error("exiftool found")

LUA ERROR exiftool not found

should do on Windows?

me don’t like to test much on windows

Yes, I know I can use arg file. But I am curious if it is possible to use more arguments directly in exiftool commamnd line…
Maybe someone expeienced with exiftool itself?

exiftool “-XMP-dc:Subject > IPTC:Keywords -XMP-dc:Title > IPTC:ObjectName” image.jpg
in the cmd.exe I got the error message:
Warning: Invalid tag name ‘iptc:keywords -xmp-dc:title > iptc:objectname’

I don’t have access to a windows box to test, but this seems to work for me on the command line in Bash:

exiftool -IPTC:Keywords=xmp-dc:Subject -IPTC:ObjectName=xmp-dc:Title image.jpg

I wouldn’t think cmd.exe would be that different; maybe just a matter of putting the arguments in quotes?

Are you sure this works in bash?
in cmd.exe I get following IPTC entries:

Keywords:	xmp-dc:Subject
Application Record Version:	4
Object Name:	xmp-dc:Title

which is expected I guess with the = operator :innocent:

should do on Windows?

It should, but I don’t have a Windows to test. Maybe we need the complete path.

@Tobias There is a PATH variable on windows, but I guess it is not mandatory? So most windows programs which rely on external binaries have some file chooser in the preferences in such cases.

I think so, because programs can be installed in different places and there is no which command.

Currently this check_if_bin_exists() function in the lua scripts is a bit of needless. There is no script/plugin installer, so there is some knowlegde required to install the scripts and users need to read the docs and description. If somethings goes wrong users likely can check themself the error logs. Unfortunately, on windows darktable.print() is only written to the log file and not printed in the cmd.exe. dartable.error() disappears quite fast. So maybe it is not easy to find errors. Once there is a script installer check_if_bin_exists() would make more sense.

Maybe we should split the thread?

Maybe we should split the thread?

Yes, That would be a good idea, but I have no clue how it works in this forum.

What is difference between these two (opposite direction and = instead of >) ?

-XMP-dc:Subject > IPTC:Keywords -XMP-dc:Title > IPTC:ObjectName
-IPTC:Keywords=xmp-dc:Subject -IPTC:ObjectName=xmp-dc:Title

Ah, so sorry! Copied the wrong line from the terminal; I’d been trying a few things and went too far back in the history. This does work for me in Bash:

exiftool '-IPTC:Keywords<xmp-dc:Subject' '-IPTC:ObjectName<xmp-dc:Title' image.jpg

Note the lack of spaces between the tag names and that I had to quote each argument separately. Hopefully that will work for you.

[edit: actually the spaces don’t matter, but enclosing each argument in quotes does.]

1 Like

The equal sign (=) assigns the value following it to the tag; > or < copies the tag in the direction of the arrow. Using your example:

The first line will copy the contents of XMP-dc:Subject to IPTC:Keywords and copy XMP-dc:Title to IPTC:ObjectName
The second line will set IPTC:Keywords to the literal value “xmp-dc:Subject” and IPTC:ObjectName to the literal value “xmp-dc:Title” which isn’t really what I wasn’t trying to do. :slight_smile:

1 Like

Yes, your are right. Following works in cmd.exe

exiftool "-IPTC:Keywords<xmp-dc:Subject" "-IPTC:ObjectName<xmp-dc:Title" image.jpg

with input image.jpg

Subject:	IPTC tags test, exiftool
Title:	title 1

results in

Object Name:	title 1
Keywords:	IPTC tags test, exiftool


Perfect. It really works in Exiftool.
Problem is it is not working in LUA script, because the script will not handle double " "
I tried:

A) cmd_options[1] = “-IPTC:Keywords<xmp-dc:Subject” “-IPTC:ObjectName<xmp-dc:Title”

B) I tried also directly into:
exif_cmd = “exiftool “…””"…tostring("-IPTC:Keywords<xmp-dc:Subject" “-IPTC:Keywords<xmp-dc:Subject”)…"""…" -overwrite_original “…”"" … imgexp … “”"

But script will not run at all with any of these options.

@P_Cherry You have to escape the quotes with \. Otherwise they get interpreted by LUA itself and not passed to the cmd.exe as they are. Please correct me if I am wrong here.

cmd_options[1] = "-XMP-dc:Subject>IPTC:Keywords\" \"-IPTC:ObjectName<xmp-dc:Title"

The outer quotes are required to save it as string. The whole command is build at the end and there I added quotes as well. So for cmd_options[1] the second quote is skipped.

exif_cmd = "exiftool ".."\""..tostring(cmd_options.value).."\"".." -overwrite_original ".."\"" .. imgexp .. "\""

For your case the script could be much more simplified as you do not need all this options?

@pk5dark: Perfect, it is really working with escapes now. Thanks a lot.

Yes, I will simplify the script for my purpose. Is it possible to specify the whole path to exiftool, not to have to copy it into Windows folder?

e.g. exif_cmd = "c:/Programs/exiftool "…