Post Reply 

Very basic Script-fu question

Aug 13, 2013, 08:01
Post: #1
Very basic Script-fu question
Hi,

I started teaching myself Script-fu two days ago, and I'm already banging my head against the wall, haha.

I'm trying to do something that seems quite simple: create a new image with a layer, and add an additional layer from a jpg file.

I can do the first bit (create a new image with one layer), but not the second one.

Here's my code... Would anybody be so kind as to tell me where I'm going wrong?
Thank you so much in advance!!!!


(script-fu-register
"test" ; func name
"test" ; menu label
"" ; description
"" ; author
"" ; copyright notice
"" ; date created
"" ; image type that the script works on
)
(script-fu-menu-register "test" "<Image>/File/Create/test")

(define (test)

(let* (
(the_image (car (gimp-image-new 750 750 RGB )))
(first_layer (car (gimp-layer-new my_image 750 750 RGB-IMAGE "base layer" 100 NORMAL)))
(new_layer (car (gimp-file-load-layers 1 the_image "zabong.jpg" )))
)
(gimp-image-add-layer the_image first_layer 0)
(gimp-context-set-background '(255 255 255) )
(gimp-context-set-foreground '(0 0 0))
(gimp-drawable-fill first_layer BACKGROUND-FILL)
(gimp-image-insert-layer the_image new_layer 0 -1)
(gimp-display-new the_image)
)
)
Find all posts by this user
Quote this message in a reply
Aug 14, 2013, 07:56
Post: #2
RE: Very basic Script-fu question
Oh.my.god. I took off the s from "gimp-file-load-layers", and BINGO!!!

Thank you SO much!

:-)
Find all posts by this user
Quote this message in a reply
Aug 14, 2013, 09:30
Post: #3
RE: Very basic Script-fu question
OK, now I have another problem: the new layer gets truncated to the image size. Is there a way to avoid that? In other words, is it actually posible to resize it before importing it? (if that makes sense?)

I've added 2 lines in my variables definition area :
(border_layer_width car((gimp-drawable-width border_layer)))
(border_layer_height car((gimp-drawable-height border_layer)))

Is there a way of testing they are returning a valid value? How would I do that?

Thanks in advance!
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Run script on action rchav 2 125 Aug 13, 2018 14:57
Last Post: rchav
  Script Fu Errors Gimp 2.10.4 lightsaber jd3481 1 219 Aug 2, 2018 05:13
Last Post: paynekj
  Script-fu script to conversion pdf to image 4ever 12 6,179 Jul 17, 2018 16:01
Last Post: paynekj
  Problems with a bat script :( ThaUnknown_ 1 437 Mar 26, 2018 21:14
Last Post: paynekj
  Script-fu ordered file list vnicent 1 264 Mar 19, 2018 17:33
Last Post: paynekj

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS