Re: [Gimp-developer] perl-fu : cannot save image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 27 Feb 2003 14:37:36 +0100, Valter Mazzola <valter@xxxxxxxxxxxxxxxx> wrote:
> Dear Raphaël
> 
> can you make an example script that calls a script-fu- logo scripts and save it?
> 
> for example this one doesn't save correctly the image: 
> 
> (begin
>       (let* 
>          (
>          (image  (car (   (script-fu-alien-glow-logo "hello hello"  150 "-*-utopia-bold-r-*-*-150-*-*-*-*-*-*-*"  '(255 0 0))    ))   )
>         ; (image     (car (gimp-file-load 0 "/root/clock.gif" "/root/clock.gif")))
>          (drawable  nil)
>          )
>    
>       (set! drawable      (car (gimp-image-flatten image)))
>       (gimp-file-save 1 image drawable "/root/a.png" "/root/a.png")
>       (gimp-image-delete image)
>       ) ;let
> )

There are a few problems in your script, such as the extra parenthesis before
the call to script-fu-alien-glow-logo.  Also, one thing that is not really
obvious is that the script returns one more than the index of the new image
(don't ask me why).  So here is a modified version of the script that should
work:

(define (script-fu-blahblah outfile)
  (let* ((img (- (car (script-fu-alien-glow-logo "hello hello" 150 "-*-utopia-bold-r-*-*-150-*-*-*-*-*-*-*" '(255 0 0))) 1))
	 (drawable (car (gimp-image-flatten img))))
    (gimp-convert-indexed img 1 0 255 0 1 "")
    (file-png-save 1 img drawable outfile outfile 0 9 0 0 0 0 0)))

You can also register this script in the menus:

(script-fu-register "script-fu-blahblah"
		    "<Toolbox>/Xtns/Script-Fu/Blahblah"
		    "Blah blah blah!"
		    "me"
		    "me"
		    "2003-02-27"
		    ""
		    SF-FILENAME "Outfile" "outfile.png")

Or if you want to invoke it directly from the command line in batch mode,
then you can replace the "(define ...)" with "(begin ...)" as you did in
your example and directly replace the value of "outfile" with the name of
the file in which you want to save the results.

-Raphaël

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux