1

I should preface this by stating that I'm a developer, not a graphic designer. I have a need to programmatically reduce image/video blur and have seen evidence that GIMP supports blur reduction:

I also see that GIMP has a "batch mode" command-line feature for doing bulk operations on lots of files at a time, and/or for typical shell/terminal usage.

I guess I'm wondering if any of these blur reduction/sharpening tools/utils are available on the GIMP command-line, where their documentation (if any exists) might be, and what some of the commands/arguments might look like.

Thanks in advance!

2

For simple sharpening, ImageMagick has a -sharpen operator:

convert foobar.jpg -sharpen 0x1.0 foobar-sharpened.jpg 

As usual with ImageMagick, this can of course be part of a more complex processing.

There is also a very complete suite of image filters called G'MIC. They can be used in a command line or as Gimp filters, so a good technique is to use them in Gimp to figure out the most suitable processing & settings and then run them in command line mode for "production".

1

For the most part, the features available in the UI are also available in batch mode.

Example script (shamelessly stolen from here)

(define (simple-unsharp-mask filename
         radius
         amount
         threshold)
 (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
        (drawable (car (gimp-image-get-active-layer image))))
  (plug-in-unsharp-mask RUN-NONINTERACTIVE
   image drawable radius amount threshold)
  (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
  (gimp-image-delete image)))

If you put this in your scripts directory, you can run it like this:

gimp -i -b '(simple-unsharp-mask "foo.png" 5.0 0.5 0)' -b '(gimp-quit 0)'

To find out what commands you can use in scripts, open GIMP and click Help > Procedure Browser.

I personally find GIMP script-fu difficult to write (it looks like Python in a blender) and use ImageMagick instead.

Edit

"Python in a blender" is more formally known as TinyScheme.

  • You can write your Gimp scripts in Python, even for batch mode. – xenoid Nov 15 '16 at 8:13
  • 1
    It's not "Python in a blender" - it is Scheme, TinyScheme to be precise. – Michael Schumacher Nov 15 '16 at 17:44
  • 1
    @MichaelSchumacher thanks for the correction. I actually wasn't sure what it was, but it looked unfriendly to me. Anytime I saw it, I'd say "nuts to that--I'll just use ImageMagick" – Scribblemacher Nov 15 '16 at 18:16
  • I like your style @Scribblemacher – smeeb Nov 15 '16 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.