Would it be possible to modify the Hugin User command script in such a way that it is also possible to use the assistant?

I regularly (when the skies are nice) make panoramas of the rising sun (that’s the advantage of retirement: I have all the time in the world). For creating the panoramas i use the Hugin User Command script. That works fine, except I have to throw away the temporary tifs and I can’t use the ‘assistant’. This is sometimes useful for making several panoramas in quick succession.

Recently I discovered that in Darktable it is possible with a LUA script. Would it be possible to modify the User command script in such a way that it is also possible to use the assistant and not?

I’m not sure I understand (for a start, I don’t know what you mean with “assistant”, sorry). But in general user commands can do whatever they want…
If you can give a better description of the missing features we can try to come up with a solution.


Hugin can be used in three ways: with the simple interface (the ‘Assistant’ with three buttons: 1) open image, 2) position and align and 3) create panorama) and with an advanced interface and expert interface.

The User script provides the advanced interface, Darktable’s LUA script provides both options: simple (automatically by the assistant) and advanced.


Do is this question for Hugin? Because you placed it in the ART category, which is a different tool. Or do you want to integrate the two?

No, it does not concern Hugin, but the ART User command script to call Hugin directly from ART

1 Like

Can you attach the user command script?

Here the user command script:
hugin_raw.sh.txt (1.9 KB)

and the LUA script:
hugin.lua.txt (8.5 KB)

I don’t think there’s a way to select the interface to run from the command line, as far as I know hugin remembers the last used interface. So, you can try starting hugin from a terminal, select the simple interface (i.e. the “assistant”), and quit, and see if now the same interface shows up the next time you run it through ART. FWIW it works here…

I understand, but I mean something else, namely that the user command directly starts the assistant without showing the GUI. So that nothing has to be filled in and the panorama is created automatically.

So maybe a second user command script, one like the one already is (which brings up the GUI) and one that immediately tries to create the panorama (like it does in Darktable’s LUA script).

Ah ok, now I understand. It’s certainly possible, but if you are asking me to do it, I’m afraid I don’t have the time right now, sorry.
I’ll see if I can give it a try in the next days, but I wouldn’t hold my breath if I were you.
(Incidentally, the whole point of user commands is to avoid having to add – and maintain – this kind of functionality myself…)

@agriggio I don’t know if it is relevant, but you wrote some user scripts to use Hugin that I never tested on W10.

The txt file

[ART UserCommand]

# the command label

# the actual command to execute (which we define below)

# we want at least 2 files to stitch

# restrict to raw files

# make sure that all shots come from the same camera/session
# we could also consider adding additional criteria, like
# MatchISO=true
# MatchDimensions=true

and the Hugin_raw.sh


# create a temporary file for a default processing profile
# here, we want to make sure we have a suitably large output color space,
# because we want to continue editing after stitching
t=$(mktemp --suffix=.arp)
cat <<EOF > $t

[Color Management]

if [ -f "$1.arp" ]; then
    # if the first selected file has a sidecar, we are going to use that
    # (except that we override the output profile, see above)
    sidecar=("-p" "$1.arp")
    # if the first selected file has no sidecar, we create a default one 
    cat <<EOF >> $t




# process the raw files with ART-cli, adding a progress dialog 
# for user notification
ART-cli "${sidecar[@]}" -p $t -Y -t -b16 -c "$@" | zenity --progress --pulsate --no-cancel --auto-close --text="Converting to TIFF..."

# remove the temporary sidecar
rm -f $t

# prepare the list of arguments to provide to hugin. 
# Note: we are using bash arrays here to be robust wrt. file names
# with spaces and/or other funny characters
for fn in "$@"; do
    i=$(expr $i + 1)

# finally, we can run hugin
hugin "${tiffs[@]}" || zenity --error --text="Something went wrong..."

I didn’t write these scripts, I thought you wrote them? :slight_smile: It works fine in Linux.

I just took a stab at changing the last line:

finally, we can run hugin

 hugin "${tiffs[@]}" || zenity --error --text="Something went wrong..."


pto_gen -o project.pto “${tiffs[@]}”
hugin_executor --assistant project.pto
hugin_executor --stitching --prefix=prefix project.pto
rm project.pto
drag 4
mv prefix.tif ~/Desktop

It works (in ART I now have two user commands: Hugin (with the GUI) and Hugun-assistant (without GUI and completely automatically)

What I haven’t managed yet (I’m no longer as good at programming as I was 40 years ago. :slight_smile: ) is to give the result a unique name. I’m going to try that.

with this addition, each panorama gets a unit name (the time), so that the panorama moved to the Desktop does not overwrite a previous one.

now=$(date +“%d_%m_%Y_%H_%M_%S”)
mv prefix.tif ~/Desktop/$now

Yes I definitely wrote it, but for demonstration/documentation purposes more than anything else. That’s why they are not shipped with art. Anyway, glad you got it working! :+1:t4: