darktable-org / lua-scripts

155 stars 110 forks source link

Add RL output sharpening script #231

Closed Mark-64 closed 4 years ago

Mark-64 commented 4 years ago

Added RL_out_sharp.lua Richardson-Lucy output sharpening using GMic This script provides a new target storage "RL output sharpen". Images exported will be sharpened using GMic (RL deblur algorithm)

Cattura15

Mark-64 commented 4 years ago

With the last commit, I think I've implemented the requested modifications. Some comments: 1) I know and truly appreciate your script for output sharpening, but I wanted something very simple to routinely apply to my edits. For comparison, the super professional Capture One applies output sharpening by default and there is an option to disable, that's all. Not a single slider. 2) I used the df.create_unique_filename() as you requested, but yes there is an issue. The count doeasn't actually stop at 99. I guess it will be quite rare to go over 99, but anyway I will make a PR for the fix, since I have one. 3) About your last comment, those statements are there only to load the last used values of the sliders in the previous DT session at statup. I tried to put those within the widget declarations, but for some weird reason it doesn't work reliably that way. I made that more clear in the code comments.

wpferguson commented 4 years ago

I exported a file just as a jpeg. Then I tried various settings with RL_output_sharpen and loaded the sharpened file and the original export as layers in GIMP. Then I set the blend mode to difference to see what effect the sharpening had. A sigma of .7 with 10 iterations had almost no effect (I couldn't find anything). I bumped the sigma to 2.0 (using my version) and could finally see a difference. You might want to try various settings and comparing the outputs to figure out a good default setting.

Mark-64 commented 4 years ago

Well, it depends on the image, the size and the usage (archive, web, print). I tipically use output sharpening when exporting images for web, in that case I resize from 6000x4000 native camera resolution to 3000x2000 and I use sigma=0.7. See the effect below in a 1:1: crop:

Unsharpened unsharpened

Sharpened sharpened

Difference difference

Anyway, in the last commit I increased the range of the sigma slider and put 1.0 as default, which by the way is the default in the Gimp plugin.

wpferguson commented 4 years ago

Looks good to me