Gimp script-fu working only sometimes

380 views Asked by At

I'm not really one of the graphic savvy people so I kinda hit a wall with this script found on the interwebz

(
define (script-fu-pcb-filter img)
(gimp-image-convert-grayscale img)
(gimp-image-flip img 1)
(gimp-image-resize img (* (cadr (cddr (gimp-selection-bounds 1))) 2) (* (caddr (cddr (gimp-selection-bounds 1))) 2) 0 0)
(gimp-layer-copy 2 1)
(gimp-image-add-layer img 3 0)
(gimp-layer-new img (cadr (cddr (gimp-selection-bounds 1))) (caddr (cddr (gimp-selection-bounds 1))) 2 "druhy" 100 0)
(gimp-image-add-layer img 4 0)
(gimp-edit-fill 4 2)
(gimp-image-lower-layer-to-bottom img 4)
(gimp-image-merge-down img 2 0)
(gimp-selection-all img)
(gimp-flip 5 0)
(gimp-floating-sel-anchor 6)
(gimp-selection-all img)
(gimp-flip 5 1)
(gimp-floating-sel-anchor 7)
(gimp-flip 3 1)
(gimp-image-merge-down img 3 0)
(gimp-convert-indexed img 0 3 0 FALSE FALSE "a")
(file-png-save 1 img 8 "/tmp/etch_eagle_export.png" "/tmp/etch_eagle_export.png" FALSE 9 FALSE FALSE FALSE TRUE FALSE)
)
(script-fu-register "script-fu-pcb-filter"
"PCB-Filter"
"Gets ready export image from egale ready for print"
"Anton Krug "
"Anton Krug"
"2009-04-25"
"RGB*, GRAY*, INDEXED*"
SF-IMAGE "Input Image" 0)

(script-fu-menu-register "script-fu-pcb-filter" "/Image/Eagle/")

It's supposed to flip an image and mirror it so that I get two copies of the same image on one page (A4 destination) and the image should retain it's original proportions i.e. no resize whatsoever. The image will then be printed on a transparency and used to etch a pcb.

I saved the script in the right folder and when I start gimp with a clean data folder (in my case /home/foo/.gimp-2.8) the script runs fine, once. I can't run the script a second time on another image after closing the first image or even after restarting gimp. I have to delete gimp's data folder and re-save it in the scripts folder for the script to run again. This kinda beats the purpose of scripts imho so I was wondering why it's now working as intended. Is there something I'm missing?

Edit: error message & addendum The error message

addendum: the menu item PCB-Filter appears 2x when I refresh the scripts from a fresh profile folder. I'm running manjaro, a derivative of arch linux, and gimp -v gives out:

$ gimp -v
GNU Image Manipulation Program version 2.8.22
git-describe: GIMP_2_8_20-60-ge39a4e1203

using GEGL version 0.2.0 (compiled against version 0.2.0)
using GLib version 2.52.3 (compiled against version 2.52.2)
using GdkPixbuf version 2.36.8 (compiled against version 2.36.6)
using GTK+ version 2.24.31 (compiled against version 2.24.31)
using Pango version 1.40.9 (compiled against version 1.40.6)
using Fontconfig version 2.12.4 (compiled against version 2.12.3)
using Cairo version 1.14.10 (compiled against version 1.14.8)

Regards

0

There are 0 answers