OK, latest stage of the script. Due to the way termux-api works, Termux has no idea about any Android processes that are launched, so it doesn’t know to wait until they are done before going to the next line in the script. Traditional wait command won’t work because of this - it’s not a shell background process. The best solution I found was to poll for change to the MD5SUM of the two temporary files we set up in advance for the raw file and the hald-CLUT.
So, set these two files up using Amaze as I mentioned above. Then, install the core utilities in Termux so we have the stat command. Do it this way: apt install coreutils.
Then, make the “filmsim.sh” script and copy it to the .shortcuts directory. Here’s the script:
#!/data/data/com.termux/files/usr/bin/sh
cd storage/dcim/Camera
rawf="temp.dng"
hc="haldCLUT.png"
rawfMDSUM=`stat -c %Y $rawf`
termux-storage-get $rawf
while [ `stat -c %Y $rawf` -eq $rawfMDSUM ]; do
sleep 2
done
hcMDSUM=`stat -c %Y $hc`
termux-storage-get $hc
while [ `stat -c %Y $hc` -eq $hcMDSUM ]; do
sleep 2
done
out=`termux-dialog -t "Output file" -i "Enter a name for output image file with file extension."`
dcraw -c $rawf | convert - $hc -hald-clut $out
exit 0
Now, when you run filmsim.sh from the Termux widget, first you pick the raw file in the first file picker, then you pick the hald-CLUT in the second file picker, and then you enter the name of the output jpg in the pop-up text dialog. After a while the code runs and the image is made! Pretty much a whole GUI pipeline to process all your raws with any hald-CLUT you like… Fun!