I was trying to setup output sharpening with the darktable lua script RL_out_sharp but it fails. I installed the script, GMIC and entered the path of the binary in my Lua options. When exporting a picture it gives the following error:
$ darktable -d lua
darktable 5.0.0
Copyright (C) 2012-2024 Johannes Hanika and other contributors.
Compile options:
Bit depth -> 64 bit
Debug -> DISABLED
SSE2 optimizations -> ENABLED
OpenMP -> ENABLED
OpenCL -> ENABLED
Lua -> ENABLED - API version 9.4.0
Colord -> ENABLED
gPhoto2 -> ENABLED
GMIC -> ENABLED - Compressed LUTs are supported
GraphicsMagick -> ENABLED
ImageMagick -> DISABLED
libavif -> ENABLED
libheif -> ENABLED
libjxl -> ENABLED
LibRaw -> ENABLED - Version 0.22.0-Devel202403
OpenJPEG -> ENABLED
OpenEXR -> ENABLED
WebP -> ENABLED
See https://www.darktable.org/resources/ for detailed documentation.
See https://github.com/darktable-org/darktable/issues/new/choose to report bugs.
0.0001 [dt starting]
darktable -d lua
3.7104 [lib_load_module] failed to open `midi': libportmidi.so.2: cannot open shared object file: No such file or directory
[gmic]./ Start G'MIC interpreter (v.3.5.0).
[gmic]./ Input file '/tmp/DSCF4721.jpg' at position 0 (1 image 4500x3005x1x3).
[gmic]./ Deblur image [0] using Richardson-Lucy algorithm, with sigma 0.70, 10 iterations and gaussian kernel.
[gmic]./ Cut image [0] in range [0,255].
[gmic]./ Round values of image [0] by 1 and nearest rounding.
[gmic]./ Output image [0] as jpg,95 file '/home/DSCF4721.jpg,95' (1 image 4500x3005x1x3).terminate called after throwing an instance of 'Magick::ErrorMissingDelegate'
what(): Magick: No encode delegate for this image format (JPG,95) reported by magick/constitute.c:2375 (WriteImage)
Magick: abort due to signal 6 (SIGABRT) "Abort"...
It looks like an ImageMagick error, but when I run the RL algorithm in GMIC-Qt it works normally so I don’t know if the error comes from the Lua script.
I think it interprets jpg,95 as an image format (and not as JPG format with quality = 95), and does not know how to produce such output. I’m not familiar with G’mic, but that’s how I decode the error message.
Hi, I wrote the original RL_out_sharp script, but it was long ago and the code changed a lot since then.
Nevertheless, as of today I am on Windows 11 with DT 5.0 and the script works fine.
You seem to be on Linux and yes, gmic seems not to like “.jpeg,95” in one string.
But in Windows if I give the command (you can see this in the lua code) gmic input.jpg -deblur_richardsonlucy 0.70,30,1 cut 0,255 round o output.jpg,95
it works just fine.
Can you test the same command on your system?
EDIT: I found that when I change the export path of the script it works if the path does not contains any space. If there is any space, the sanitize_filename function will add simple quotes around the path like this: gmic input.jpg -deblur_richardsonlucy 0.70,30,1 cut 0,255 round o '/folder with space/output.jpg',95 and this make the script to fail…
Although Darktable can handle file names containing spaces, GMic cli cannot, so if you want to use this script please make sure that your images do not have spaces in the file name and path
OK, I see. The problem here is that when you specify a filename with spaces, G’MIC assumes the filename may contain other strange exotic characters (such as the ,), so it is included automatically in the filename.
The solution in this case is to use:
$ gmic testimage2d 512 o \"filename with space.jpg\",95