Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom Window Title for Folder Selection
#1
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
Reply
#2
Not as far as I know. This said, in what ways does cropping sucks in 2.10?
Reply
#3
(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)

   
   
   

Could it be something to do with changes to scaling interpolation, if any?
Reply
#4
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):

   

If you scale down 4x, you get this:

   

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.
Reply
#5
How would I set the interpolation used in a script? (and what was its default in 2.8.22?)
Reply
#6
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.
Reply


Forum Jump: