Gimp-Forum.net
Custom Window Title for Folder Selection - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP)
+---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions)
+---- Thread: Custom Window Title for Folder Selection (/Thread-Custom-Window-Title-for-Folder-Selection)



Custom Window Title for Folder Selection - radzo73 - 06-09-2020

Hey,
In my GIMP 2.8.22 script (because cropping in 2.10 sucks), I've registered a PF_DIRNAME as (PF_DIRNAME, "file_inpath", "Input Image Folder", "/tmp"), and unlike a PF_FILE, where the window title is "[title] - [PF_FILE name]", it shows "Python-Fu Folder Selection". Is there a way to change the window title so that it's just "[the PF_DIRNAME folder name]"?

With hope,
radzo73


RE: Custom Window Title for Folder Selection - Ofnuts - 06-09-2020

Not as far as I know. This said, in what ways does cropping sucks in 2.10?


RE: Custom Window Title for Folder Selection - radzo73 - 06-09-2020

(06-09-2020, 10:46 PM)Ofnuts Wrote: Not as far as I know. This said, in what ways does cropping sucks in 2.10?

From what I've been told, it's because the cropped/resized images are blurry (see attached, the script (run in both .8 and .10) masks a selection, crops it, and resizes it to a constant, which results in differences shown below)

[attachment=4518]
[attachment=4519]
[attachment=4520]

Could it be something to do with changes to scaling interpolation, if any?


RE: Custom Window Title for Folder Selection - Ofnuts - 06-10-2020

Yes, lilkely an interpolation problem. What is you default interpolation set to? When you scale down, you can have artefacts due to spatial-frequency folding. How/when these artefacts appear is a combination of the image characteristics and the frequency response of the interpolation algorithm. Some algorithms look better/worse on some images but you can't draw conclusions, which is why you can safely ignore most blanket statements about such and such algorithm being better. There are also people who advocate a stepped algorithm (ie scale down in several steps).

A general cure is to pre-blur the image before scaling it down to remove all the details that won't be visible anyway in the scaled down version. This acts as a low-pass filter, and removes the high frequencies that as a consequence won't be folded over (the stepped algorithm is just the accumulated cutoffs of each step acting as a global low-pass filter).

For instance, staring with this (click for full size)(path rendering already created a small moiré effect):

[attachment=4522]

If you scale down 4x, you get this:

[attachment=4523]

The top result had no pre-blur, the bottom one had a 1.5 blur applied. It doesn't look less sharp, but the moiré is much less visible.

For some information on the LoHalo/NoHalo methods in Gimp 2.10 (that are enhanced version of the sinc/Lanczos in 2.8) see here and here.


RE: Custom Window Title for Folder Selection - radzo73 - 06-11-2020

How would I set the interpolation used in a script? (and what was its default in 2.8.22?)


RE: Custom Window Title for Folder Selection - Ofnuts - 06-14-2020

Before you use it: pdb.gimp_context_set_interpolation(interpolation). In practice the code in your plugin should be  bracketed by pdb.gimp_context_push()/pdb.gimp_context_pop() (or gimp.context_push()/gimp.context_pop()) so that any context changes don't change general settings.

IIRC the default one in 2.8 was "Cubic" but I could be wrong or you could have changed it.