Gimptalk - Premier Gimp Community: Script-fu in batch mode trouble. - Gimptalk - Premier Gimp Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Script-fu in batch mode trouble.

#1 User is offline   lyqyd 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 14-January 11

Posted 14 January 2011 - 11:10 AM

I've written a script to combine two images into one (a background image and a mostly-transparent mask image), performing a colorize operation on one of the layers before merging them and saving to one of the original files. This script works quite well in the script-fu console in GIMP (using GIMP 2.6.7 on Windows 7 x64), but won't run correctly from the command line using GIMP in batch mode. Here is the script:

(define (script-fu-pixelmap-single-block-map mainmap blockmap blockhue)
	(let* ((mainimage (car (gimp-file-load RUN-NONINTERACTIVE mainmap mainmap))))
		(gimp-image-add-layer mainimage (car (gimp-file-load-layer RUN-NONINTERACTIVE mainimage blockmap)) -1)
		(gimp-colorize (car (gimp-image-get-active-drawable mainimage)) blockhue 100 50)
		(gimp-file-save RUN-NONINTERACTIVE mainimage (car (gimp-image-merge-visible-layers mainimage CLIP-TO-BOTTOM-LAYER)) mainmap mainmap)
		(gimp-image-delete mainimage)))

(script-fu-register "script-fu-pixelmap-single-block-map"
	"PixelMap Single Block Map Mixer"
	"Creates a single resource map image\
		from two Pixel Map images."
	"Chris Beach"
	"2011, Chris Beach"
	"January 13, 2011"
	""
	SF-STRING "Map File Location" ""
	SF-STRING "Block-map File Location" ""
	SF-VALUE "Block Map Hue" "180"
)


Here is the script-fu console output after a successful run of the script inside GIMP:

> (script-fu-pixelmap-single-block-map "C:\\Program Files (x86)\\PixelMap\\worldmap13JAN2011.png" "C:\\Program Files (x86)\\PixelMap\\block56map13JAN2011.png" 180)
(#t)


And here is the output when attempting to run it from the command-line with identical options:

C:\Program Files (x86)\GIMP-2.0\bin>gimp-console-2.6.exe -i -b '(script-fu-pixelmap-single-block-map "C:\\Program Files (x86)\\PixelMap\\worldmap13JAN2011.png" "C:\\Program Files (x86)\\PixelMap\\block56map13JAN2011.png" 180)'

(gimp-console-2.6.exe:4180): Gimp-Core-CRITICAL **: gimp_image_opened: assertion `GIMP_IS_GIMP (gimp)' failed

(gimp-console-2.6.exe:4180): Gimp-Core-CRITICAL **: gimp_image_opened: assertion `GIMP_IS_GIMP (gimp)' failed
GIMP-Error: Opening 'C:\Program Files (x86)\GIMP-2.0\bin\180)'' failed: No such file or directory

batch command executed successfully
^C


I googled around to try to find information on the errors I was getting, but couldn't find anything.
0

#2 User is offline   paynekj 

  • Member
  • PipPip
  • Group: Members
  • Posts: 383
  • Joined: 01-June 05
  • LocationUK

Posted 14 January 2011 - 12:49 PM

I'm not sure that single quotes work in DOS commands. I'd try the following:

"C:\Program Files (x86)\GIMP-2.0\bin>gimp-console-2.6.exe" -i -b "(script-fu-pixelmap-single-block-map \"C:\\Program Files (x86)\\PixelMap\\worldmap13JAN2011.png\" \"C:\\Program Files (x86)\\PixelMap\\block56map13JAN2011.png\" 180)" -b "(gimp-quit 0)"


you might also want to add in the --verbose switch, although in my experience it doesn't help much.
Kevin
0

#3 User is offline   lyqyd 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 14-January 11

Posted 14 January 2011 - 07:20 PM

Your suggestion worked, thank you very much for your help. The quotes do seem to have been the issue.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic