Switch to full style
Post your GIMP animations here
Post a reply

Gimp Help

Sat Apr 01, 2017 12:16 pm

Hi everyone. I could use some help. I wanna to know how to take an imported gif, add a canvas to the left or to the bottom, make that bottom white, fill the white space with text, and save the imported gif so the words and the white area stay in place as the gif moves. thanks if you can help me. If you need an example of what i need i will provide one. thanks for anyone that's willing to help.

Re: Gimp Help

Sun Apr 02, 2017 5:47 am

LazyNinjas wrote:Hi everyone. I could use some help. I wanna to know how to take an imported gif, add a canvas to the left or to the bottom, make that bottom white, fill the white space with text, and save the imported gif so the words and the white area stay in place as the gif moves. thanks if you can help me. If you need an example of what i need i will provide one. thanks for anyone that's willing to help.

Thought i already answered this but i may have closed before saving my response. :lol
Anyways try the attached script.
Code:
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.

; revised December 2010 to honor layer visibility

;; Combine each layer of the image with a copy of the background layer

(define (script-fu-sg-anim-combine-background image)
  ; get visible layers (bottom-to-top)
  (define (get-visibles image)
    (let loop ((layers (vector->list (cadr (gimp-image-get-layers image))))
               (visibles '()) )
      (if (null? layers)
        visibles
        (loop (cdr layers)
              (if (zero? (car (gimp-drawable-get-visible (car layers))))
                visibles
                (cons (car layers) visibles) ) ) ) ) )
               
  (gimp-image-undo-group-start image)
  (let* ((layers (vector->list (cadr (gimp-image-get-layers image))))
         (visibles (get-visibles image))
         (bg-layer (car (last layers)))
         (orig-sel (car (gimp-selection-save image))) )
    (gimp-selection-none image)
    (map (lambda (x) (gimp-drawable-set-visible x FALSE)) visibles)
    (when (= (car visibles) bg-layer)
      (set! visibles (cdr visibles))
      (gimp-drawable-set-visible bg-layer TRUE) )
    (while (pair? visibles)
      (let* ((layer (car visibles))
             (position (car (gimp-image-get-layer-position image layer)))
             (base-layer 0)
             (layer-name "") )
        (gimp-drawable-set-visible (car visibles) TRUE)
        (set! layer-name (car (gimp-drawable-get-name layer)))
        (set! base-layer (car (gimp-layer-new-from-drawable bg-layer image)))
        (gimp-image-add-layer image base-layer (+ position 1))
        (gimp-drawable-set-visible base-layer TRUE)
        (set! base-layer (car (gimp-image-merge-down image layer CLIP-TO-BOTTOM-LAYER)))
        (gimp-drawable-set-name base-layer layer-name) )
      (set! visibles (cdr visibles)) )
    (gimp-selection-load orig-sel)
    (gimp-image-remove-channel image orig-sel) )
  (gimp-image-undo-group-end image)
  (gimp-displays-flush)
  )

(script-fu-register "script-fu-sg-anim-combine-background"
  "<Image>/Filters/Animation/_Combine background"
  "Combine each layer of the image with a copy of the background layer"
  "Saul Goode"
  "Saul Goode"
  "4/22/2007"
  "*"
  SF-IMAGE    "Image"    0
  )

;; Overlay each layer of the image with a copy of the background layer

(define (script-fu-sg-anim-overlay-background image)
  ; get visible layers (bottom-to-top)
  (define (get-visibles image)
    (let loop ((layers (vector->list (cadr (gimp-image-get-layers image))))
               (visibles '()) )
      (if (null? layers)
        visibles
        (loop (cdr layers)
              (if (zero? (car (gimp-drawable-get-visible (car layers))))
                visibles
                (cons (car layers) visibles) ) ) ) ) )
  (gimp-image-undo-group-start image)
  (let* ((layers (vector->list (cadr (gimp-image-get-layers image))))
         (visibles (get-visibles image))
         (bg-layer (car (last layers)))
         (orig-sel (car (gimp-selection-save image))) )
    (gimp-selection-none image)
    (map (lambda (x) (gimp-drawable-set-visible x FALSE)) visibles)
    (when (= (car visibles) bg-layer)
      (set! visibles (cdr visibles))
      (gimp-drawable-set-visible bg-layer TRUE) )
    (while (pair? visibles)
      (let* ((layer (car visibles))
             (position (car (gimp-image-get-layer-position image layer)))
             (over-layer 0) )
        (gimp-drawable-set-visible layer TRUE)
        (gimp-image-set-active-layer image layer)
        (set! over-layer (car (gimp-layer-new-from-drawable bg-layer image)))
        (gimp-image-add-layer image over-layer -1)
        (gimp-drawable-set-visible over-layer TRUE)
        (gimp-image-merge-down image over-layer EXPAND-AS-NECESSARY) )
      (set! visibles (cdr visibles)) )
    (gimp-selection-load orig-sel)
    (gimp-image-remove-channel image orig-sel) )
  (gimp-image-undo-group-end image)
  (gimp-displays-flush)
  )

(script-fu-register "script-fu-sg-anim-overlay-background"
  "<Image>/Filters/Animation/_Overlay background"
  "Overlay each layer of the image with a copy of the background layer"
  "Saul Goode"
  "Saul Goode"
  "4/22/2007"
  "*"
  SF-IMAGE    "Image"    0
  )


Save it in your /.gimp-2.8/scripts folder as "sg-anim-overlay-background.scm" and go to Filters>Script-Fu>Refresh Scripts - you will then find it here
Filters/Animation/_Overlay background

TO USE:
1) Open your GIF
2) Create a new TEXT layer where you want it to show in the GIF - place it on the bottom of the layer stack
3) Run the overlay bg script option
4) Run Filters>Animation>Play Back to check

There is also an option added to COMBINE bg to each layer.

Re: Gimp Help

Wed May 10, 2017 7:24 pm

That script works great, thanks Rod. I was looking for those functions, but couldn't find them.....

Re: Gimp Help

Thu May 11, 2017 6:17 am

racer-x wrote:That script works great, thanks Rod. I was looking for those functions, but couldn't find them.....

Your welcome for the script but i did not write it. This is a script written by Saulgoode hence (sg). =)

Re: Gimp Help

Thu May 11, 2017 4:14 pm

Do you know if exists a script that will export all layers as image sequence named numerically like: 001.png, 002.png, 003.png and so on?

**Edit: Never mind, This one works just fine: download/file.php?id=29367
Post a reply