Witamy, Gość. Zaloguj się lub zarejestruj.
Czy dotarł do Ciebie email aktywacyjny?


Zaloguj się podając nazwę użytkownika, hasło i długość sesji

Strony: [1]
DrukujPobierz PDF
Autor Wątek: Animacja-przydatne skrypty.  (Przeczytany 25343 razy)
0 użytkowników i 1 Gość przegląda ten wątek.
POGO
Użytkownik

Reputacja: 7 Offline Offline

Płeć: Mężczyzna
GIMP: 2.8 + GAP
Licencja: Copyright
Wiadomości: 541
Galeria Użytkownika



Zobacz profil
« : 31.07.2011, 19:54:55 »

Bardzo pomocny skrypt,pozwala zaoszczędzić sporo czasu.W skrypcie znajdziecie dwie funkcje:
Pierwsza-Combine background, podkłada tło pod wszystkie widoczne warstwy.
Druga     - Overlay background nakłada obraz na wszystkie widoczne warstwy.
Skrypt znajdziecie Filtry->Animacja. Działa poprawnie w GIMPie 2.6.x

Skopiuj skrypt do notatnika i zapisz np. sg-Combine background.scm Koniecznie z rozszerzeniem
.SCM Instalujemy skrypt w folderze skrypty GIMP 2.0 lub 2.6.

Kod:
; 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
  )


edit:  W załączniku zaktualizowany skrypt do wersji 2.8,działa poprawnie w wersji 2.6 też.

* sg-combine-bg_1_1.zip (1.24 KB - pobrany 2252 razy.)
« Ostatnia zmiana: 08.05.2012, 18:12:32 wysłane przez POGO » Zapisane

POGO
Użytkownik

Reputacja: 7 Offline Offline

Płeć: Mężczyzna
GIMP: 2.8 + GAP
Licencja: Copyright
Wiadomości: 541
Galeria Użytkownika



Zobacz profil
« Odpowiedz #1 : 31.07.2011, 20:03:39 »

Skrypt Wszystkie warstwy do rozmiaru obrazu(All Layers to Image Size)
Zapisz go do folderu skryptów, odświeżyć skrypt (Filtry> Script-Fu> Skrypty Odśwież) i można go znaleźć  Warstwy-> All Layers to Image Size. Pracuje w RGB, skali szarości i indeksowane typy obrazów.
Bardzo pomocny przy zabawie z APNG.


Kod:
; GIMP - The GNU Image Manipulation Program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
;
; 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.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
;
;
;
; Script can be found under Layer > All Layers to Image Size


; Define the Function

(define (fp-script-fu-all-layers-to-image-size
   img     
            drawable)


(gimp-context-push)
(gimp-image-undo-group-start img)

(map (lambda (x) (gimp-layer-resize-to-image-size x)) (vector->list (cadr (gimp-image-get-layers img))))

(gimp-image-undo-group-end img)

(gimp-context-pop)

(gimp-displays-flush)


)

(script-fu-register "fp-script-fu-all-layers-to-image-size"
  "<Image>/Layer/All Layers to Image Size"
  "Resize all the layers in an image to the same size as the image."
  "Art Wade"
  "Art Wade"
  "May 24, 2010"
  "*"
  SF-IMAGE          "Image" 0
  SF-DRAWABLE       "Drawable" 0

)
Zapisane

MareroQ
Użytkownik

Reputacja: 13 Offline Offline

Płeć: Mężczyzna
GIMP: 1.*
Licencja: Copyright
Wiadomości: 584
Galeria Użytkownika

MareroQ


Zobacz profil
« Odpowiedz #2 : 01.09.2011, 19:00:38 »

POGO
Dla tych, którzy przegapili na http://registry.gimp.org/node/25538
może warto również polecić GIMP Lightbox ?
Skrypt - Animation-Lightbox-Script_1.2.scm o 25 funkcjach chyba warty jest Twojego komentarza, a może również spolszczenia ?

z nadzieją i pozdrowieniami
MareroQ
Zapisane
POGO
Użytkownik

Reputacja: 7 Offline Offline

Płeć: Mężczyzna
GIMP: 2.8 + GAP
Licencja: Copyright
Wiadomości: 541
Galeria Użytkownika



Zobacz profil
« Odpowiedz #3 : 04.09.2011, 12:22:46 »

No na pewno wart jest polecenia,szczególnie posiadaczom tabletów (rysowanie myszą jest jak wbijanie gwoździ kamieniem).Nie wiem czy warto jest rozpisywać się na temat Lightbox,osoby które obcowały już kiedyś z programami typu Pivot Stickfigure Animator czy też w ogóle mają podstawowe pojęcie o animacji nie powinny mieć problemu.Dla nowych polecam to Lightbox-How to.  laugh
Zapisane

POGO
Użytkownik

Reputacja: 7 Offline Offline

Płeć: Mężczyzna
GIMP: 2.8 + GAP
Licencja: Copyright
Wiadomości: 541
Galeria Użytkownika



Zobacz profil
« Odpowiedz #4 : 08.05.2012, 18:14:16 »

Aktualizacja skryptu.Czytaj pierwszy post.
Zapisane

be@
Moderator globalny

Reputacja: 49 Offline Offline

Płeć: Kobieta
GIMP: 2.8
Licencja: CC-BY
Wiadomości: 7 400
Galeria Użytkownika



Zobacz profil
« Odpowiedz #5 : 03.12.2017, 05:14:50 »

Ponieważ wiele osób nie wie jak użyć skryptu Combine background i Overlay background, to dodam, że warstwa która ma zostać nałożona lub podłożona na/pod wszystkie klatki animacji musi się znajdować na samym dole stosu warstw, a po użyciu skryptu trzeba ją usunąć.
Zapisane
Strony: [1]
DrukujPobierz PDF
Polskie Forum Użytkowników GIMP-aDodatkiPluginy i Script-FuWątek: Animacja-przydatne skrypty.
Skocz do: