Let's talk a little about GMIC's sketchbw filter

I’ve been playing around with it for ages, getting great results one day, cr@p the other…oh well, that’s life. I’ve written a little bash script with my favourite settings for this script so I can apply it fairly quickly to a number of images in batch mode.

#!/bin/bash
let "nbfiles = $#"
ref=$(kdialog --title "Sketch" --progressbar "(Initialising ...)" 15)
qdbus $ref Set org.kde.kdialog.ProgressDialog maximum $nbfiles
compteur=0
for i in "$@";do
	if [ -f "$i" ];then
            let "compteur +=1"
            FILE="$i"
	fi
    FILE_NO_EXT=${i%.*}

    echo $i
    echo $local
    gmic -i $i -fx_sketchbw 3,45,180,30,1.75,0.02,0.5,1.42,0.1,0.7,3,6,0,1,4,0,50,50 -o $FILE_NO_EXT-sketch.jpg
    qdbus $ref setLabelText "Sketch: image created: `basename "$FILE"` ($compteur of $nbfiles files)"
    qdbus $ref Set org.kde.kdialog.ProgressDialog value $compteur

done
qdbus $ref close

I noticed the results varied quite dramatically with the size of the image. Sometimes the sketch effect is lost on a 24mp image and it comes to life after downsizing the image, applying the script and resizing it back up to original dimensions. Larger images sometimes end up with a muddled or somewhat “fuzzy” appearance.

The point I’m making is that with some of the GMIC filters, size does make a difference and you should experiment a bit. Here are a few examples (resized to about 2000pixels on the long side):

The original image, as it came out of DarkTable:

Then the very same image with the GMIC filter applied to its full-size version:


I find it a bit “muddy” looking, not really my idea of a sketch or drawing.

So here’s what happens when I scale the image to 66% of its pixel dimensions, apply the Gmic filter and finally scale it back up to the original size:


Going in the right direction but I want to push on for a few more.

This is a rescale to 33% of original pixel dimensions, Gmic filter applied and rescaled to the original size:


Which, to my eye, is much MUCH better already.

And finally the whole process at 20%:

To me, the 100% and 66% look like a bad raw conversion, the 20% is just way oversimplified and leaves out detail while the 33% version has the best balance between photo and drawing but I’d be interested to hear what others think so let me know which version you liked best (or you just didn’t like this filter at all of course, all valid responses)

2 Likes

I don’t use this filter. Have you tried adjusting length (the forth parameter)? By its name, I am guessing larger images would warrant longer lengths…?

(I am also thinking that the sketching could use some randomization in size and emphasis but I suppose that could be done with blending and masking.)