doc:appunti:linux:gimp_batch
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:linux:gimp_batch [2022/11/23 17:20] – [The erode filter] niccolo | doc:appunti:linux:gimp_batch [2022/11/23 17:39] (current) – [Call the script from the command line] niccolo | ||
|---|---|---|---|
| Line 42: | Line 42: | ||
| (gimp-image-delete image))) | (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 " | ||
| + | </ | ||
| + | |||
| + | ===== Combining Imagemagick and GIMP ===== | ||
| + | |||
| + | The final recipe works as follow: | ||
| + | |||
| + | * Enlarge the image at 250% with Imagemagick. This proved to be the best choice to enhance the text readability via the erode filter. This is because the erode filter works by adding a single pixel around the dark parts. | ||
| + | * Apply the GIMP erode filter. | ||
| + | * Use Imagemagick to apply the **%%-unsharp%%** filter. Resize to the original size and crop/resize the image to a fixed size, even if the input image is slightly wider or narrower. Force the resolution to 200 dpi ignoring that of the original image. | ||
| + | |||
| + | This is the full script, which **receives the filename** to be processed and saves the output file into the **./ | ||
| + | |||
| + | <code bash> | ||
| + | #!/bin/bash | ||
| + | |||
| + | BASENAME=" | ||
| + | TMP=" | ||
| + | |||
| + | convert " | ||
| + | cp -p simple-myerode.scm / | ||
| + | gimp -i -b " | ||
| + | convert " | ||
| + | -scale ' | ||
| + | -background white -extent ' | ||
| + | -quality 90 \ | ||
| + | " | ||
| + | rm " | ||
| + | </ | ||
doc/appunti/linux/gimp_batch.1669220456.txt.gz · Last modified: by niccolo
