GIMP Script-fu

Update of "sg-isolate"
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: c080e0771e7462d20007f6f3a4a340a9d9a3c6f9
Page Name:sg-isolate
Date: 2013-05-24 17:25:21
Original User: saulgoode
Parent: e023aa867d2d7d7f3fa1599e109f6619180355e0
Content
Command:
Isolate
Menu:
"<Image>/Edit/Isolate"
PDB Name:
script-fu-sg-isolate
Download:
sg-isolate.scm (after the page appears, click on the "Download" command)
License:
GPLv2+

Description:

If there is a selection, running this script will result in the contents of the current drawable being deleted everywhere except within the selection. This is basically a convenient substitute for the sequence Select->Invert, Edit->Clear, Select->Invert except that layers without an alpha channel will have one added (resulting in transparency rather than background fill).

In addition, if the currently active drawable is a layermask or a channel, the mask or channel is filled with a grayscale copy of the current selection.

I find using this function after duplicating a layer is often preferable to floating a selection or doing a copy/paste. Floating a selection removes the content from the original layer and can sometimes re-position the copied region. Both floating and copying result in the new layer being placed at the top of the layerstack (whereas duplicating a layer places it directly above the original). Using "Edit->Paste As->New Layer" positions the new layer above the original in the layerstack, but also relocates the new layer to the upper-left corner of the image (which is likewise not often desirable).