Re: Script-Fu beginner...

2000-04-01 Thread Ingo Ruhnke

Fábio Sato <[EMAIL PROTECTED]> writes:

> I can use a script to open the images and call another one to do the
> dirty job, passing the references to the images and to the drawables
> (like you mentioned). So my problem is this: how can I open a file
> (within a script) and get a reference to the background layer ?

Something like this should work (untested):

(define (my-get-background-layer image)
(let ((layers (cadr (gimp-image-get-layers image
  (aref layers (- (length layers) 1

(define (do-something)
  (let* ((image (car (gimp-file-load 0 "/home/ingo/images/nasa.xcf" "nasa.xcf")))
 (background-layer (my-get-background-layer image)))
 ...))

-- 
ICQ: 59461927http://pingus.seul.org | 
Ingo Ruhnke <[EMAIL PROTECTED]> http://home.pages.de/~grumbel/ |
'



Re: Script-Fu beginner...

2000-03-31 Thread Fábio Sato

Hi Christian,

---
> .
> .
> .
> Then you get a reference to the active layer, called drawable ...
> You simple pass 'drawable' to all the functions then. Was this
> your problem ?
---

Ok, this works if you work interactively, when you open the files by
yourself and right click on the image and select the script. But my
problem is that I want it to work in batch mode, so I have to open the
images in the script.

I can use a script to open the images and call another one to do the
dirty job, passing the references to the images and to the drawables
(like you mentioned). So my problem is this: how can I open a file
(within a script) and get a reference to the background layer ?

Thanks a lot!
-- 
Fábio Sato - [EMAIL PROTECTED]



Re: Script-Fu beginner...

2000-03-30 Thread Christian Schlange

Hi Fabio,

>  I'm wondering how do I know which is the reference to the background
>  layer of a image that I've just opened. I think that my error is
>  occurring when I try to pass the drawable references to the
>  gimp-edit-copy/paste functions. I simple passed "0" (I don't know any
>  reference, so I thought that "0" would refer to first layer in the
>  stack), but it's not working...

Register the function like:

(script-fu-register
"script-fu-selection-split-image"
"/Script-Fu/Selection/Split An Image"
"description ..."
"author "
"."
"03/09/2000"
"RGB* GRAY*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
more parameters 

and define it as:

(define (script-fu- image drawable ... more parameters)

Then you get a reference to the active layer, called drawable ...
You simple pass 'drawable' to all the functions then. Was this 
your problem ?

Bye,
Christian 





Script-Fu beginner...

2000-03-30 Thread Fábio Sato

Hi people,

I'm beginning to work with script-fu and I'm having a little difficulty
to load two images and paste one into other.

I'm wondering how do I know which is the reference to the background
layer of a image that I've just opened. I think that my error is
occurring when I try to pass the drawable references to the
gimp-edit-copy/paste functions. I simple passed "0" (I don't know any
reference, so I thought that "0" would refer to first layer in the
stack), but it's not working...

This is what I've tried:

;;
(define (teste fileImg1 fileImg2)
  (let*
(
  (img1)
  (img2)
)

  ; Ahh! Other question: what is the difference between these guys?
  ; -
  ; --/
  ; ||

  (set! img1 (car (gimp-file-load 0 fileImg1 fileImg1)))
  (set! img2 (car (gimp-file-load 0 fileImg2 fileImg2)))
 
  (gimp-edit-copy img1 0)
  (gimp-edit-paste img2 0 TRUE)
 
  (gimp-display-new img2)
  )
)
 
(script-fu-register
  "teste"
  "/Xtns/Script-Fu/Teste/Teste"
  "Teste"
  ""
  ""
  ""
  ""
 
  SF-VALUE "Image 1: " "\"mapafinal.jpg\""
  SF-VALUE "Image 2: "
"\"manha.gif\""  
)


Thanks
-- 
Fábio Sato - [EMAIL PROTECTED]