I’m comparing them at 300%, toggling between them. There is no difference in sharpness or small details. Maybe the ringing artifacts on your lanczos-10step gives the appearence of more sharpness, but when aligning them and toggling between them there is no difference. To be honest, I expected more difference if you know how the files were generated :P.
(different version of DT, different imagemagick? different jpeg encoder, lots of scaling steps vs just one, etc…).
Now that I open them in Affinity Photo and align them manually there in layers, and toggle one on/off, I even see there is a quite a big leap in sharpness in mine (the ‘def_resize’ version, just the -resize
in linear space). Around the grill and the headlights of the car there is a big increase in sharpness in mine. I’m thinking you got the files mixed up if you think the lanczos-10step version is sharper here. I do not see any more haloing on mine but I do see more JPEG artifacts in certain sharp areas. But I’ve used a different JPEG encoder I’m sure, and since I have more details there, it’s harder for JPEG to compress.
the ‘def_resize’ version is made as following:
- Load the NEF into my custom Darktable build (latest R-Darktable, so 3.9 base)
- Load your XMP
- Render out at full size 16bit uncompressed tif, in linear rec2020.
magick -quiet darktable-output-file.tif -resize 1600x1600 +profile "*" -profile Rec2020-elle-V4-g10.icc -black-point-compensation -intent relative -profile sRGB-elle-V4-srgbtrc.icc pnm:- | cjpeg-static -quality 92 -outfile output-file.jpg
exiftool "-icc_profile<=sRGB-elle-V4-srgbtrc.icc" -overwrite_original output-file.jpg
So I export linear rec2020 fullsize from Darktable, load that into Imagemagick to do the resizing (so it’s still in linear rec2020 at that point), then convert the resized to sRGB, and pipe it into mozjpeg to encode. Then finally tag the file with the v4 srgb icc file to be sure.
the -1, -2, -3 and -4 files from earlier were @snibgo 's resampleHM script that I’ve linked to.
resamplehm darktable-output-file.tif 1600x1600 d 50 0 0 outputfile.tif
.
The ‘50’ in that line is the sharpening amount. For 1, 2, 3 and 4 I’ve used 50, 100, 150 and 200 respectively.
I don’t think I’ve changed the script (much). I did alter the gamma assumptions to this:
set colspIn=-set colorspace RGB
set colspOut=-set colorspace RGB
Which basically means 'assume input is linear space, and assume output is linear space.
So the script doesn’t do anything with the profile inside of Darktable’s output file, it just assumes it’s linear RGB (but it’s linear rec2020, close enough).
Then the output is written to a TIF file. I then load that tif file into imagemagick to convert the colorspace and pipe it into mozjpeg:
magick output-from-resamplehm.tif +profile "*" -profile Rec2020-elle-V4-g10.icc -black-point-compensation -intent relative -profile sRGB-elle-V4-srgbtrc.icc pnm:- | cjpeg-static -quality 92 -outfile output-file.jpg
I’ve modified the resamplehm.bat file to output the imagemagick commandline that it’s using. And for the sharpening set to 100 (-2 version) this is the oneliner:
magick -quiet 20201122_07.36.44_DSC_3665.tif -alpha off -set colorspace RGB -define filter:c=0.1601886205085204 -filter Cubic -distort Resize 1600x1600 ( -clone 0 -gamma 3 -define convolve:scale=100%,100 -morphology Convolve DoG:3,0,0.4981063336734057 -gamma 0.3333333333333333 ) ( -clone 0 -define convolve:scale=100%,100 -morphology Convolve DoG:3,0,0.4981063336734057 ) -delete 0 ( -clone 1 -colorspace gray -auto-level ) -compose over -composite -set colorspace RGB +depth -compress None DSC_3665_out_2.tif
As I read it (snibgo might give a better explanation if he can still remember it :P)
- Use the very soft / no-distortion-at-all Cubic EWA filter with a modified ‘c’ parameter to downsize, in linear space.
- Create a copy of it, apply a gamma of 3 (so you are in a general ‘gamma corrected space’), apply a sharpening filter.
- Create another copy of the downsized version, apply a sharpening filter, but keep it in linear space.
- So now you have a linear-downscaled-but-sharpened-in-gamma-3 version, and one linear-downscaled-but-sharpened-in-gamma-1 version.
- and oversimplifying it too much: These are overlaid on top of each other / merged to give the output.