Post Reply 

Image, Layers...

Nov 26, 2012, 11:28
Post: #1
Image, Layers...
Hi, I'm trying to process some images and am trying to figure out what's going on here. From my understanding, image in gimp-file-load-layer is the destination image so image is now an image, so I thought I could use it. But I get unbound variable on image. I can find tutorials where the image is already open or is created, but not for when I open them myself and then process them. Thank you for the help.

Code:
(define (script-fu-prcess)
  (let* ((filelist (cadr (file-glob "*.png" 0))))
    (while (not (null? filelist))
      (let* (
            (filename (car filelist))
            (layer (gimp-file-load-layer 0 image filename))
        )
      ; process image
      (file-png-save 1 image layer filename filename 1 1 1 1 1 1 1)
      (gimp-image-delete image)
      )
     (set! filelist (cdr filelist))
    )      
  )
)
Find all posts by this user
Quote this message in a reply
Nov 26, 2012, 12:52
Post: #2
RE: Image, Layers...
gimp-file-load-layer is really the equivalent of "File/Open as layers" which assumes there is already an image. What you want to do is more likely gimp-file-load (that creates a new image from the file and returns it).

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Nov 26, 2012, 23:36
Post: #3
RE: Image, Layers...
Hi, when, in my let statement, I just put :
Code:
(image (car (gimp-file-load 0 filename filename)))
(layer (car (gimp-image-get-active-layer image)))
I get
Code:
Calling error for procedure 'gimp-image-get-active-layer':
Procedure 'gimp-image-get-active-layer' has been called with an invalid ID for argument 'image'. Most likely a plug-in is trying to work on an image that no longer exists.  
Execution error for 'Remove Transparent':
Error: Procedure execution of gimp-image-get-active-layer failed on invalid input arguments: Procedure 'gimp-image-get-active-layer' has been called with an invalid ID for argument 'image'. Most likely a plug-in is trying to work on an image that no longer exists.
I don't understand because I put the right kind of parameter (image). I thought these 2 statements were the equivalent of passing in SF-IMAGE and SF-DRAWABLE. Thanks for your explanation on gimp-file-load-layer.
Find all posts by this user
Quote this message in a reply
Nov 27, 2012, 00:34
Post: #4
RE: Image, Layers...
I'd try to put a print statement to check the image id obtained in gimp-file-load.

Otherwise it could be a code problem (variable scope?) but I can't help much(*)


(*) I stay away from Scheme as much as possible and, given the pervasiveness of Python now that it's standard in 2.8, I don't see any benefit in using Scheme.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Nov 27, 2012, 00:47
Post: #5
RE: Image, Layers...
Thanks for the tip, I was getting annoyed at all those brackets. Smile
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Dividing and printing a large image RayArdia 1 50 Aug 9, 2017 07:22
Last Post: ythgilb
  Late binding / COM for opening an image into GIMP? i73 2 57 Aug 4, 2017 17:39
Last Post: i73
  PDB call to Image/Canvas size... ? Shadowes 3 322 Sep 1, 2014 22:31
Last Post: Shadowes
  G'MIC Image Sequence AdrParkinson 7 449 Aug 10, 2014 08:12
Last Post: AdrParkinson
  Sample Colorize all layers Deskulpa 3 335 Jul 24, 2014 08:49
Last Post: rich2005

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS