Post Reply 

Very basic Script-fu question

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

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!!!!

"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 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
  Problems with a bat script :( ThaUnknown_ 1 323 Mar 26, 2018 21:14
Last Post: paynekj
  Script-fu ordered file list vnicent 1 169 Mar 19, 2018 17:33
Last Post: paynekj
  script-fu argument/parameter formats dhugg 2 273 Mar 13, 2018 00:50
Last Post: dhugg
  Request for script chlebna 1 450 Sep 13, 2017 09:35
Last Post: ythgilb
  Request for script - Guillotine + Watermark sunslick 1 503 Sep 4, 2017 08:51
Last Post: ythgilb

Forum Jump:

GIMP ForumPortalArchiveContactTermsRSS