It is currently Mon Apr 15, 2024 8:20 am


All times are UTC - 5 hours [ DST ]


Switch to mobile style

Post new topic Reply to topic  [ 30 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Combine and Overlay background script
PostPosted: Tue Dec 14, 2010 5:07 pm  (#1) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
The script either overlays or combines a background layer to the rest of the layers. I would like to know if it's possible to make the script work only on visible layers.

Right now it works on all layers.

; 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.

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

(define (script-fu-anim-combine-background image drawable)
  (define (get-all-layers img)
    (let* (
        (all-layers (gimp-image-get-layers img))
        (i (car all-layers))
        (bottom-to-top ())
        )
      (set! all-layers (cadr all-layers))
      (while (> i 0)
        (set! bottom-to-top (append bottom-to-top (cons (aref all-layers (- i 1)) '())))
        (set! i (- i 1))
        )
      bottom-to-top
      )
    )
  (gimp-image-undo-group-start image)
  (let* (
      (layers (get-all-layers image))
      (bg-layer (car layers))
      (base-layer)
      (layer-name)
      (pos)
      )
    (set! layers (cdr layers))
    (set! pos  (length layers))
    (while (pair? layers)
      (gimp-drawable-set-visible (car layers) TRUE)
      (set! layer-name (car (gimp-drawable-get-name (car layers))))
      (set! base-layer (car (gimp-layer-new-from-drawable bg-layer image)))
      (gimp-image-add-layer image base-layer pos)
      (gimp-drawable-set-visible base-layer TRUE)
      (set! base-layer (car (gimp-image-merge-down image (car layers) EXPAND-AS-NECESSARY)))
      (gimp-drawable-set-name base-layer layer-name)
      (set! pos (- pos 1))
      (set! layers (cdr layers))
      )
    )
  (gimp-image-undo-group-end image)
  (gimp-displays-flush)
  )

(script-fu-register "script-fu-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
SF-DRAWABLE "Drawable" 0
)

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

(define (script-fu-anim-overlay-background image drawable)
  (define (get-all-layers img)
    (let* (
        (all-layers (gimp-image-get-layers img))
        (i (car all-layers))
        (bottom-to-top ())
        )
      (set! all-layers (cadr all-layers))
      (while (> i 0)
        (set! bottom-to-top (append bottom-to-top (cons (aref all-layers (- i 1)) '())))
        (set! i (- i 1))
        )
      bottom-to-top
      )
    )
  (gimp-image-undo-group-start image)
  (let* (
      (layers (get-all-layers image))
      (bg-layer (car layers))
      (over-layer)
      (layer-name)
      )
    (set! layers (cdr layers))
    (while (pair? layers)
      (gimp-drawable-set-visible (car layers) TRUE)
      (gimp-image-set-active-layer image (car layers))
      (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! layers (cdr layers))
      )
    )
  (gimp-image-undo-group-end image)
  (gimp-displays-flush)
  )

(script-fu-register "script-fu-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
SF-DRAWABLE "Drawable" 0
)

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Tue Dec 14, 2010 5:55 pm  (#2) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
Oregonian wrote:
I would like to know if it's possible to make the script work only on visible layers.


Sure that is possible !
But to know also how to...then i fear we will have to wait for Saulgoode , RobA , Fencepost or anyway some script fu guru

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Tue Dec 14, 2010 8:28 pm  (#3) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Oregonian wrote:
The script either overlays or combines a background layer to the rest of the layers. I would like to know if it's possible to make the script work only on visible layers.

Right now it works on all layers.


http://chiselapp.com/user/saulgoode/rep ... combine-bg

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Last edited by saulgoode on Wed Jan 19, 2011 12:54 pm, edited 2 times in total.

Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Tue Dec 14, 2010 9:42 pm  (#4) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
Works great. Thanks so much, saulgoode.

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Wed Dec 15, 2010 10:37 am  (#5) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
3 hours and 21 minutes to get a modified script, SG?

What poor service :D

Seriously, how is anyone else supposed to contribute here if you swoop in with the solution so quickly all the time!

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Wed Dec 15, 2010 11:10 am  (#6) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
that Saulgoode is remarkable to say the least. Wish I had his talent and knowledge. All you script guys are great..

_________________
Image


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Wed Dec 15, 2010 12:31 pm  (#7) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
This is one example of what I was trying to accomplish using the script and being able to block the background layer from copying to all layers.

The sparkle layers are 5 layers that repeat. I didn't want to have the dancer dancing as fast as the sparkle layer; the dancer repeats itself for two layers. There are a total of 20 layers.


dancer #1
sparkle layer #1
dancer #1
sparkle layer #2
dancer #2
sparkle layer #3
dancer #2
sparkle layer #4
dancer #3
sparkle layer #5
etc.

Hope that makes sense. :cool

Image

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Wed Dec 15, 2010 1:08 pm  (#8) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
that is a very kewl hip hop, "O"

_________________
Image


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Wed Dec 15, 2010 1:21 pm  (#9) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
:tyspin Molly.

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Thu Dec 16, 2010 9:10 pm  (#10) 
Offline
GimpChat Member
User avatar

Joined: Apr 08, 2010
Posts: 5420
Location: Northwest Ohio
this would make a good tutorial!


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Thu Dec 16, 2010 10:06 pm  (#11) 
Offline
GimpChat Member
User avatar

Joined: Oct 19, 2010
Posts: 376
Location: North Central Ohio, USA
2-ton wrote:
this would make a good tutorial!

Seconded. :bigthup

_________________
Life Truth: #12
My cat is a worst typist than I am.


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Thu Dec 16, 2010 10:16 pm  (#12) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4045
Thirded. :yes

Darn, I need to change a light bulb and there are no other Oregonians around. :hoh

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Thu Dec 16, 2010 10:20 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Oct 19, 2010
Posts: 376
Location: North Central Ohio, USA
mahvin wrote:
Darn, I need to change a light bulb and there are no other Oregonians around. :hoh

Caught that, eh? :rofl
That's from that goofy fortunes program that displays messages in the terminal window. Made me LOL, and I thought of O.

_________________
Life Truth: #12
My cat is a worst typist than I am.


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Fri Dec 17, 2010 3:38 am  (#14) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
Bob63 wrote:
Q: How many Oregonians does it take to change a light bulb?
A: Three. One to change the bulb and two to hold off all the Californians trying to "share the experience, man."

mahvin wrote:
Darn, I need to change a light bulb and there are no other Oregonians around. :hoh

:rofl

The Oregonian that changes the light bulb must wear a rubber wet suit and stand on a stool with glass insulators on the legs for protection from electrical shock.

Oregonians have at least 100 different words to describe rain. Those two Oregonians are at the border and before they'll let a Californian enter Oregon the Californian is required to name at least 2 kinds of rain.

Oregonians: "Name two different kinds of rain."
Californians: "What's rain, man?"
Oregonians: "Border crossing denied. Go back to your own country, dude."

Are you sure you want a tutorial for that? It requires working with two different images and renaming 20 layers.

Image


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Fri Dec 17, 2010 10:44 am  (#15) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4045
Quote:
Are you sure you want a tutorial for that? It requires working with two different images and renaming 20 layers.


Sure! Why not? You could make that part interesting by adding riddles or clues for us to solve, lol. [wink].

I can honestly admit that I have searched for tutorial software to help speed the process up, there are none that are completely effective. I've learned the fastest way is to make documents and convert them to PDFs. Videos are the fastest, but of the many people I have exchanged emails with, have always said that videos should be accompanied with text/documents, because they move too fast. Wink works well for that, but it doesn't speed things up in creating the tutorial.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Fri Dec 17, 2010 11:21 am  (#16) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
mahvin wrote:
Sure! Why not? You could make that part interesting by adding riddles or clues for us to solve, lol. [wink].


:lol The tutorial will be puzzling enough. It will take awhile to write. I have to think my way through doing it and try to make it clear to the person trying to follow it.

I agree, I like text instructions. They are easier to follow. It's fun to watch a vid but you have to keep stopping and starting it.

I think the people who make good tutorial videos deserve gold stars though. They must write notes to themselves or outlines that they follow before recording. Even that text would be helpful.

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Fri Dec 17, 2010 11:44 am  (#17) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4045
Not to run off course with the original topic, but in regards to video tutorials: I tried to find someone who was a recorder, to transcribe videos to text files. I'm waiting for Dragon speech software to be perfected enough to allow transcription without training the software. Google has been working on this very project and has their software transcribing voicemails in Google Voice, with some degree of success.

In the case of your animation, I "think" the part most of us want to see is the implementation of this script with your project (speaking for myself, this is what I'd like to see). Maybe cover the parts that are most obvious to perform, with minimal instruction, and expand most on the script use. Greg did a good job of this with his Ornament tutorial.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Fri Dec 17, 2010 11:50 am  (#18) 
Offline
GimpChat Member
User avatar

Joined: Oct 19, 2010
Posts: 376
Location: North Central Ohio, USA
mahvin wrote:
Not to run off course with the original topic, but in regards to video tutorials: I tried to find someone who was a recorder, to transcribe videos to text files. I'm waiting for Dragon speech software to be perfected enough to allow transcription without training the software. Google has been working on this very project and has their software transcribing voicemails in Google Voice, with some degree of success.

Closed-captioning?? :)

_________________
Life Truth: #12
My cat is a worst typist than I am.


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Fri Dec 17, 2010 12:10 pm  (#19) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Oregonian wrote:
Are you sure you want a tutorial for that? It requires working with two different images and renaming 20 layers.

By the time you reach that level of complexity, the GAP would be a much better solution. Actually, the GAP is a good solution for the simple case that the script addresses, but the script is perhaps a little simpler to learn and is available on all platforms.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Combine and Overlay background script
PostPosted: Fri Dec 17, 2010 12:23 pm  (#20) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
I seriously considered using GAP. There were 5 text layers and 10 dancer layers to begin with.

I had to double each dancer so that it would be dancer 1, dancer 1; dancer 2, dancer 2; etc. in that order.

The 5 text layers I imagine would have to be looped in order to have it 20 layers in the final image.

I didn't quite know how to pull all that off, so decided to do it manually.

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
Post new topic Reply to topic  [ 30 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Please make a python plugin to combine my GEGL filters with GMIC

1

No new posts Pattern Overlay Errors

1

No new posts Attachment(s) GEGL Color Light Fusion (12 blend modes for color overlay)

9

No new posts Background patterns

3

No new posts Attachment(s) Background or Wallpaper

1



* Login  



Powered by phpBB3 © phpBB Group