doc:appunti:linux:gimp_batch
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
doc:appunti:linux:gimp_batch [2022/11/23 17:18] – created niccolo | doc:appunti:linux:gimp_batch [2022/11/23 17:29] – [Call the script from the command line] niccolo | ||
---|---|---|---|
Line 3: | Line 3: | ||
I had a set of many scanned images from magazine pages, the sizes were varying and I wanted to apply the GIMP **erode filter** to enhance the text readability. Generally for image batch processing I use **Imagemagick** from the command line, but I was not able to reproduce the erode filter with Imagemagick, | I had a set of many scanned images from magazine pages, the sizes were varying and I wanted to apply the GIMP **erode filter** to enhance the text readability. Generally for image batch processing I use **Imagemagick** from the command line, but I was not able to reproduce the erode filter with Imagemagick, | ||
- | ===== The erode filter ===== | + | ===== The plug-in-erode filter ===== |
You can apply the erode filter in GIMP from menu //Filters// => //Generic// => //Erode//. There is no dialog box to control the filter parameters, but it turned out that when you want to call the **plug-in-erode** function from a script you have to pass several parameters. | You can apply the erode filter in GIMP from menu //Filters// => //Generic// => //Erode//. There is no dialog box to control the filter parameters, but it turned out that when you want to call the **plug-in-erode** function from a script you have to pass several parameters. | ||
Line 20: | Line 20: | ||
It is not simple to have an explanation of each paramter, so I proceeded by trials. It turned out that the wanted result is obtaiuned by passing // | It is not simple to have an explanation of each paramter, so I proceeded by trials. It turned out that the wanted result is obtaiuned by passing // | ||
+ | |||
+ | ===== Creating a script to call plug-in-erode ===== | ||
+ | |||
+ | The next step was to create a script which will simply call the plug-in, this is the file that I saved as **simple-myerode.scm**: | ||
+ | |||
+ | < | ||
+ | (define (simple-myerode | ||
+ | filename | ||
+ | propagate-mode | ||
+ | propagating-channel | ||
+ | propagating-rate | ||
+ | direction-mask | ||
+ | lower-limit | ||
+ | upper-limit) | ||
+ | (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) | ||
+ | | ||
+ | (plug-in-erode | ||
+ | image drawable propagate-mode propagating-channel | ||
+ | propagating-rate direction-mask lower-limit upper-limit) | ||
+ | (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename) | ||
+ | (gimp-image-delete image))) | ||
+ | </ | ||
+ | |||
+ | Copy the script into the **$HOME/ | ||
+ | |||
+ | ===== Call the script from the command line ===== | ||
+ | |||
+ | Now it is possibile to execute the GIMP in batch mode, using the **%%-b%%** option. Calling the custom function '' | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | gimp -i -b " | ||
+ | </ | ||
+ | |||
doc/appunti/linux/gimp_batch.txt · Last modified: 2022/11/23 17:39 by niccolo