0

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

Toby Speight
  • 27,591
  • 48
  • 66
  • 103
  • This script uses an ancient registration mechanism (must be meant for Gimp 2.2-2.4). I'm not proficient enough in Scheme to fix it (I I use Python for my Gimp scripts). To go with Python, a [script that does symmetries](https://sourceforge.net/projects/gimp-tools/files/scripts/ofn-symmetries.zip), how to use batch scripting in Gimp [here](https://stackoverflow.com/questions/44430081/how-to-run-python-scripts-using-gimpfu-from-windows-command-line/44435560#44435560) and [there](https://stackoverflow.com/questions/42888125/resize-image-by-percentage-on-both-x-and-y-on-command-line-with-gimp). – xenoid Sep 07 '17 at 07:21
  • However, since this is for programming questions, there are much better/efficient ways than Gimp to do this kind of things. In scripts one would use the ImageMagick toolbox (which also has bindings more most popular programming languages), or specialized libraries (pillow for Python, for instance). – xenoid Sep 07 '17 at 12:09
  • Hmm, okay. I'll look into ImageMagick. Any pointers that can kick me off in the right direction? – the_architecht Sep 07 '17 at 17:26
  • http://www.imagemagick.org – xenoid Sep 07 '17 at 19:38
  • So what happens when you try to run the script a second time? – Michael Schumacher Sep 08 '17 at 05:44

0 Answers0