GT Portal . Forums . Official Tutorials . Art Galleries . FAQs . Search . New Posts . Contact Us Login  .  Register


GimpTalk Announcement :
Try your digital-art skills against your fellow gimpers in GIMPtalk's Biweekly Art competition !


Board index » GIMP Art Galleries and Resources » GIMP Plugins, Filters, and Scripts Make Money Online . Free Image Hosting Script . Convert FLV to Cell Phone Format
Featured Tutorial : Learn how to create characters by Griatch
Search for :  


Post new topic Reply to topic   [ 18 posts ]  


Author Message
 Post subject:
PostPosted: Thu Dec 20, 2007 3:45 pm 
Offline
User avatar

Joined:
Tue Mar 01, 2005 4:40 pm

Topics: 127
Posts: 2261

Find User's Topics

This script is a simple one, yet very useful. The script copies all of the visible layers in the active image and pastes them into a single layer at the top of the layer stack (the new layer is called "Copied Layers"). This way, if you want to apply additional effects to the "current look" of your layers, you can do so in one simple step and, most importantly, keep your original layers intact. Also, if a selection is active at the time the script is run, only the selected area will be copied/pasted.

You can download it here: http://fence-post.deviantart.com/art/Copy-Visible-and-Paste-Script-72552828

These steps can be done quite easily in GIMP (Copy Visible > Paste > Add New Layer > Anchor Floating Selection), but this really speeds things up.

Essentially, it is GIMP's version of Photoshop's Apply Image option (although I believe the PS version has more options....not sure on that though).

The inspiration for this script is from kward (http://kward1979uk.deviantart.com/art/Merge-copy-28607825) who wrote the original version, but I've updated it to run in GIMP version 2.4. I've also modified the script to work on Grayscale and Indexed images.

Just download the zip file, double-click the zip file to open, and place the script (scm file) in your GIMP scripts folder (ie....C:\Program Files\GIMP-2.4\share\gimp\2.0\scripts)

Then, go to the main GIMP window (not the image window) and choose the Xtns Menu > Script-FU > Refresh Scripts and it should appear in the Image Window under the Edit Menu > Copy Visible & Paste as Layer

Enjoy!

Art



Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 4:56 pm 
Offline
User avatar

Joined:
Sun Jun 11, 2006 12:37 pm

Topics: 172
Posts: 2973

Find User's Topics
I'm sure that this will be a very welcome script, especially for signature makers where applying effects to a copy visible layer is often used. The update to allow it to work on non-RGB images is also an excellent idea. If I hadn't already heavily modified kward's version I would have installed this.

I have a potential suggestion regarding the placement of the option within the menus. This may just be my personal preference, and it doesn't affect the functionality as such, so this would just be a personal preference choice. With my modified version of kward's script I have the command appearing amongst the other copy commands. See this:


Image

If you think this is a good idea and want to implement it you just need to alter the menu registration as follows:

"<Image>/Edit/Copy/Copy Visible & Paste"

But anyway, an excellent script.


_________________
tl;dr


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 5:17 pm 
Offline
User avatar

Joined:
Tue Mar 01, 2005 4:40 pm

Topics: 127
Posts: 2261

Find User's Topics
Excellent tip! I wasn't aware you could specify it to be located in a sub-menu like that. That's pretty cool. I've modified the script accordingly.

Off-topic: I wasn't aware that you're no longer Insanity-Prevails here....just figured that out! :w:


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 5:22 pm 
Offline
User avatar

Joined:
Mon Jun 13, 2005 11:15 am

Topics: 583
Posts: 7097

Find User's Topics
Hy fenceposte
i was hoping for something alike, i used very often that script, and the new options are cool

@Fatal Edge

Did you already posted your version of "copy merge" somewhere ? ...could you give me the link?

_________________
Image

http://www.flickr.com/photos/97844002@N00/


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 5:24 pm 
Offline
User avatar

Joined:
Tue Mar 01, 2005 4:40 pm

Topics: 127
Posts: 2261

Find User's Topics
Glad you found it useful, PC!

Art


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 7:04 pm 
Offline
User avatar

Joined:
Mon Jun 13, 2005 11:15 am

Topics: 583
Posts: 7097

Find User's Topics
Art
i didn't know you know how wright script fu, a very nice surprise (same i could say for Fatal Edge :h:)

My suggestion is just for the name i think something as "Visible2NewLayer" may give a better hint of what the script does

But well also the actual name is clear...no so much for the original script name "copy-merged"

_________________
Image

http://www.flickr.com/photos/97844002@N00/


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 9:23 pm 
Offline
User avatar

Joined:
Sun May 20, 2007 6:15 pm

Topics: 156
Posts: 1835

Find User's Topics
Wow, thanks. This will definitely help a lot.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 9:46 pm 
Offline
User avatar

Joined:
Tue Mar 01, 2005 4:40 pm

Topics: 127
Posts: 2261

Find User's Topics
@PhotoComix: This is only my second script....the Powertoning one (which is linked to the Powertoning tutorial on this site) was my first. My brain isn't really "wired" for programming so I have to take everything really slow, which is why my scripts are so simple. FatalEdge sounds like he's more wired for it, cuz his first few scripts appear quite sophisticated for someone who's new to the whole thing.

@greentunic: glad you like it!

Art


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 10:28 pm 
Offline

Joined:
Mon Nov 07, 2005 1:51 pm

Topics: 1
Posts: 55

Find User's Topics
Art,
this script is very very useful , thanks a lot !
(on Gimp 2.2 I used copy-merge script from kward every time I used Gimp :h: )
so thanks again
:h:


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 11:08 pm 
Online
User avatar

Joined:
Mon Aug 22, 2005 8:35 pm

Topics: 78
Posts: 3812

Find User's Topics
I hope you won't mind if I offer a few pointers.

From the opening post:
Quote:
Also, if a selection is active at the time the script is run, only the selected area will be copied/pasted.


I would assume the desired behavior is that the pasted layer appears in the same position as the original selection; however, your script will run into problems of the pasted layer being offset (from its original location) in certain situations. One situation is caused by the fact that GIMP tries to ensure that whenever something is pasted, the result lies within the view window so the user does not have to go looking for it. Another is that, in the event that the pasted buffer exceeds the boundaries of the active drawable, GIMP will center the pasted buffer over that drawable (horizontally, vertically, or both; as necessary).

Also, your script creates a new layer in the 'let*' block. This lies outside the UNDO group so the layer will not be "uncreated" if the user performs an UNDO. While there will be no apparent problem with this, the memory from that created layer will remain tied up until you close the GIMP (this is called a "memory leak"). For this reason, you should avoid creating layers (selections, masks, paths, etc) in your 'let*' block. Just declare 'theResult' variable in the 'let*' block and then create the new layer from within the UNDO grouping.

You probably should perform a 'gimp-displays-flush' at the end of your script. This will ensure that the image view and associated docks are updated.

_________________
this is bizarre ... it's crazy ... it's stupid ... how can this ... oh my God! It's brilliant!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 11:21 pm 
Offline
User avatar

Joined:
Tue Mar 01, 2005 4:40 pm

Topics: 127
Posts: 2261

Find User's Topics
@barbara: You're very welcome!

@saulgoode: Thanks for reviewing it and providing me with the feedback. I need all I can get! :w: I'll study your explanation a bit more tonight and modify the script accordingly to fix as you suggested. Being a non-programmer, even the simple stuff has been a challenge. I'm trying to read up on Scheme & Script-Fu programming resources (I've got tons of links), in hopes to put together tools that are not only functional, but are properly written. Your suggestion is one small step to a more properly written one! LOL (ok, I'm not really LOL'ing, but I always wanted to type that.)

BTW, do you have some suggestions for resolving the selection issue you addressed in your first paragraph? That part I'm not sure on how to fix.

Thanks again.

Art


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 21, 2007 12:43 am 
Online
User avatar

Joined:
Mon Aug 22, 2005 8:35 pm

Topics: 78
Posts: 3812

Find User's Topics
Quote:
BTW, do you have some suggestions for resolving the selection issue you addressed in your first paragraph? That part I'm not sure on how to fix.


A good approach would be to save the selection to a channel, select none, copyvisible-n-paste to a new layer, then restore, invert, and clear the selection. This will work because the copy buffer (and resultant floating selection) will be the same size as the image, and not be offset. I wrote a similar script a couple of months back ("Image->Merge Visible to New Layer") that basically takes that approach, except that I don't actually invert and clear the selection (it is, of course, retained so that I can do that afterwards, should I wish).

Make sure that you "clean up" after you finish by restoring the original selection and removing the channel that your script created. My script used a named buffer (which I had to remove afterwards) because I did not want my default copy buffer to be affected by what I viewed as a merging of layers. It is reasonable that your script should modify the default copy buffer because it is viewed as a copy operation.

----------------

Can I ask why you ZIP your files? It would be preferable (to me) if I could just view it as a text page without downloading and UNZIPping -- I wouldn't even mind waiting those endless milliseconds for all those extra kilobytes. :l:

_________________
this is bizarre ... it's crazy ... it's stupid ... how can this ... oh my God! It's brilliant!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 21, 2007 4:03 pm 
Offline
User avatar

Joined:
Tue Mar 01, 2005 4:40 pm

Topics: 127
Posts: 2261

Find User's Topics
Thanks for the suggestions! I'll try working on implementing them this weekend. I have a suspicion this programming stuff may be more than my brain can handle. :w: Of course, I thought the same thing about GIMP back when I first started with it, so hopefully I'll get better as time goes on.

Quote:
I wrote a similar script a couple of months back


Well, crud. I guess it really makes mine un-necessary. If I knew that one was available, I wouldn't have posted this one. But, nonetheless, it's a good learning experience, so all is not lost.

Quote:
Can I ask why you ZIP your files?


Force of habit! At work, we're sending stuff back and forth between clients and everything's got to be zipped up due to filesize restrictions. Plus, I'm trying to do my part to preserve bandwidth. :l:

If you feel so inclined, you could take a look at my powertoning script and see if I've done anything incorrectly. I looked it over and but didn't see anything glaring, but after reviewing your above suggestions, I wonder if 2 of the variables I declared in the let* block are wrong. (I mean the script works fine on the surface, but from a programming standpoint it could create "problems".) That script can be found here: http://fence-post.deviantart.com/art/GIMP-Powertoning-Script-71897344. I've checked that one out and it's in scm format. Maybe you could brew some coffee while waiting for it to download!

Thanks for all the help. What a learning experience.

Art


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 22, 2007 5:07 am 
Offline
User avatar

Joined:
Mon Jun 13, 2005 11:15 am

Topics: 583
Posts: 7097

Find User's Topics
Hy Art
you may guess who requested that script ? :w:
Was something on top of my wishlist, ...and i was really happy then Kward wrote copy-merged

And i'm even more happy for copy visible & paste , i really missed something alike for gimp 2.4
to me should be bundled in Gimp,perfectly replace a missed feature equivalent to PS "Apply to Image" .
a perfect Christmas gift for my Gimp...:h:really welcome

_________________
Image

http://www.flickr.com/photos/97844002@N00/


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 24, 2007 4:03 pm 
Offline
User avatar

Joined:
Sun Dec 09, 2007 4:29 pm

Topics: 18
Posts: 99

Find User's Topics
Thank you for the script, works nice.

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 26, 2007 4:11 am 
Offline
User avatar

Joined:
Tue Mar 01, 2005 4:40 pm

Topics: 127
Posts: 2261

Find User's Topics
Glad y'all have found the script a benefit. I'm just happy to get a successful script put together! :w: I've updated it now based on saulgoode's suggestions, but instead of allowing the script to copy & paste only the selected area, I just temporarily turned off the selection, stored it in a channel, and then turned the selection back on after the script is run. You can always invert > delete the selection if you so choose. IMO, this is probably the way the script will be used anyway. The script is also reposted in a non-zip format (per arm-twisting by saulgoode!)

@PhotoComix: Merry Christmas!! :l:

@saulgoode: Thanks again for the suggestions and letting me see your version, as that was a good learning opportunity in itself.

I noted that you used the procedure (I guess these a called procedures?):

gimp-edit-named-copy-visible & gimp-edit-named-paste whereas I used gimp-edit-copy-visible & gimp-edit-paste. In the procedure browser, I noted that your version stores the operations for later use regardless of cut or copy operations. Is there an advantage to using your way or is it a matter of preference?

I also like the way you didn't define a new layer in the script to which you would paste/anchor the contents, but used the gimp-floating-sel-to-layer float procedure to handle that in one step. Seems a lot easier/cleaner. But I just left my script as is, since there's no reason to make my script identical to yours.

Thanks a bunch.

Art


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 26, 2007 5:53 am 
Online
User avatar

Joined:
Mon Aug 22, 2005 8:35 pm

Topics: 78
Posts: 3812

Find User's Topics
Quote:
You can always invert > delete the selection if you so choose. IMO, this is probably the way the script will be used anyway.


Indeed. Such an approach is also simplified if you have a script which will clear everything except the selected region. This was one of the first Script-fus I ever wrote and I find myself using it almost as much as I use "Edit->Clear" (http://flashingtwelve.brickfilms.com/GIMP/Scripts/select-isolate.scm).

Quote:
I noted that you used the procedure (I guess these a called procedures?):


I tend to call them "functions" since they can return values (in programming terminology, procedures do not generally return anything; they just "do" things), but "procedures" is fine (they are listed as such in the Procedural DataBase). To all the strange denizens of the world of lambda calculi, they are neither functions or procedures; they are semantically referred to as "closures" since they encapsulate a mutable environment space at the point of evaluation (and they don't really return values, they "evaluate to abstractions"). This is probably why nobody understands functional programming, including functional programmers.

Quote:
gimp-edit-named-copy-visible & gimp-edit-named-paste whereas I used gimp-edit-copy-visible & gimp-edit-paste. In the procedure browser, I noted that your version stores the operations for later use regardless of cut or copy operations. Is there an advantage to using your way or is it a matter of preference?


The difference is that the default, unnamed copy buffer (often called a "clipboard") will not be modified as a side effect. It should not be assumed that a copy will be immediately followed by a paste, the user might very well do other things in the interim. Imagine if you performed a copy and then ran a script which, for example, pixelized your image; you would expect your clipboard contents to be unchanged. Since my script "merged layers", I wished the clipboard to be unchanged. Since your script performed a "copy" to a new layer, it might be expected to affect the clipboard (it might also be argued that it should not).

_________________
this is bizarre ... it's crazy ... it's stupid ... how can this ... oh my God! It's brilliant!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 26, 2007 9:49 pm 
Offline
User avatar

Joined:
Tue Mar 01, 2005 4:40 pm

Topics: 127
Posts: 2261

Find User's Topics
Quote:
This is probably why nobody understands functional programming, including functional programmers.


:l:

Quote:
The difference is that the default, unnamed copy buffer (often called a "clipboard") will not be modified as a side effect. It should not be assumed that a copy will be immediately followed by a paste, the user might very well do other things in the interim. Imagine if you performed a copy and then ran a script which, for example, pixelized your image; you would expect your clipboard contents to be unchanged. Since my script "merged layers", I wished the clipboard to be unchanged. Since your script performed a "copy" to a new layer, it might be expected to affect the clipboard (it might also be argued that it should not).


Makes perfect sense! Thanks for all your help.

Art


Top
 Profile  
 
Display posts from previous:  Sort by  

Post new topic Reply to topic
 [ 18 posts ] 



Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Related Website
Gimp tutorials database
All rights reserved © GimpTalk 2008
forum software by
phpBB