RSS/Atom feed Twitter
Site is read-only, email is disabled

layer manipulation question, scripting, etc.

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

6 of 8 messages available
Toggle history

Please log in to manage your subscriptions.

layer manipulation question, scripting, etc. Eric Smith 16 Feb 23:57
layer manipulation question, scripting, etc. David Millet 17 Feb 03:37
  layer manipulation question, scripting, etc. Eric Smith 18 Feb 21:35
1096.1045437909@burren.cx 07 Oct 20:15
  layer manipulation question, scripting, etc. Eric Smith 17 Feb 00:40
   layer manipulation question, scripting, etc. Eric Smith 17 Feb 00:50
eric-gimp@brouhaha.com 07 Oct 20:15
  layer manipulation question, scripting, etc. Jeff Trefftzs 17 Feb 01:35
Eric Smith
2003-02-16 23:57:32 UTC (about 21 years ago)

layer manipulation question, scripting, etc.

I have a few questions about dealing with layers.

Is there an easy way to select a rectangular area and then move (cut/paste) it to the same location on a different layer? When I try normal cut & paste, there doesn't seem to be an obvious way to preserve the exact location.

Is there an easy way to save each layer to separate files?

What I'm trying to do is take monochrome (bilevel) scanned images from a document that originally had some black text and line art and a small amount of text in another color (typically red), select the part that should be red, move it to a different layer, and save the two layers as separate TIFF G4 files.

Perhaps there's an easier way to do this than using layers, but I specifically don't want to have to make two copies of the original file, independently select the area in both, and clear the inside of the area in one file and the outside in another.

A related problem I'd like to solve is taking a bilevel scanned image, selecting a rectangular area that contains a dithered photo, clearing the photo, and writing the coordinates of the selection to a file or to standard out for use in a later processing stage.

The motivation of all this is the use of a high-speed duplex scanner (Ricoh IS520), which ONLY supports bilevel, to produce archival PDF files of documents that may have some colored text or some photos. In the case of photos, the plan is to separately scan those pages on a color or greyscale scanner, and merge the photos into the PDF using a separate images-to-PDF program I'm currently developing. But I'm only trying to write a command-line/script interface for my program, and would prefer to somehow leveage GIMP to handle the user interface needed to select and manipulate the necessary region selections.

I assume that if there's no easy built-in way to do what I want, that it should be possible to write some script-fu to do it? I read the Script-Fu chapters of the GIMP manual, and I've done some emacs-lisp hacking in the past, so the basic concepts are not too foreign, but it's still not obvious how to do the things I desire.

Thanks for any suggestions! Eric

Eric Smith
2003-02-17 00:40:53 UTC (about 21 years ago)

layer manipulation question, scripting, etc.

David Burren wrote:

Surely something like this would work? - Duplicate the layer
- Select the appropriate area
- With one layer active, clear the selected area - Switch to the other layer, invert the selection, and again clear

OK, I'll try that. It sounds like it will do what I need, which is satisfactory for now.

However, I'd ultimately like to come up with an easier way for the user to do that, since it will need to be done hundreds of times in a single scanned document. Can anyone offer a hint as to how to write a macro that I can attach to a menu item or hot key? I've already RTFM, but I'm somewhat stumped.

Thanks very much! Eric

Eric Smith
2003-02-17 00:50:18 UTC (about 21 years ago)

layer manipulation question, scripting, etc.

David Burren wrote:

Surely something like this would work? - Duplicate the layer
- Select the appropriate area
- With one layer active, clear the selected area - Switch to the other layer, invert the selection, and again clear

I wrote:

OK, I'll try that. It sounds like it will do what I need, which is satisfactory for now.

On second thought, it's not quite what I want, though it may be a step in the right direction. The problem is that there are going to be multiple rectangular selections in the same page that I want to move from the original layer into a new layer. And I want them to wind up in a *single* new layer, not a bunch of them. I guess that if each selection wound up in a distinct new layer, that I could hide the original layer then use Merge Visible Layers, but by the time all is said and done this will be quite a cumbersome process.

And once I get my selections into the second layer, I still need to figure out how to save the two layers into independent TIFF files.

Thanks, Eric

Jeff Trefftzs
2003-02-17 01:35:17 UTC (about 21 years ago)

layer manipulation question, scripting, etc.

Eric wrote:

Is there an easy way to select a rectangular area and then move (cut/paste) it to the same location on a different layer? When I try normal cut & paste, there doesn't seem to be an obvious way to preserve the exact location.

Instead of doing a cut (^X), try doing a copy (^C) on the rectangular area. Then you can create a new layer (transparent, if you like) and paste the copy into it. This will put the copy at the same coordinates as the original. Using cut as the first operation centers the resulting paste operation. Of course to remove the same rectangle from the original layer you need to recover it, which you can do with alpha-to-selection in the layer where you pasted it the first time.

Is there an easy way to save each layer to separate files?

Short answer - no. You only save images. Now, if you want to make only one layer visible, then you can save the image (/File/Save as ...), and repeat ad lib for each separate layer. A script fu to do this might be easier.

HTH,

David Millet
2003-02-17 03:37:25 UTC (about 21 years ago)

layer manipulation question, scripting, etc.

a couple of thoughts:

1) if you want to save a layer separately, the easiest way i know of to do that is to click on the layer in the layers, channels, and paths dialoge, drag it to the toolbar, and it will create a new image with just that layer. then save it to whatever you need

2) to move the different colored text to a different layer and keep it in the same spot, i would do the following:

1. use the select contiguous regions tool, select the red letters 2. hit ctrl-c to copy, then ctrl-k to clear whats in the selection 3. create a new layer
4. right click on the image and choose Edit>Paste Into

if you know how to customize keyboard shortcuts you could make this process really ez

cheers,
david

__________________

Eric Smith
2003-02-18 21:35:38 UTC (about 21 years ago)

layer manipulation question, scripting, etc.

"David Millet" wrote:

a couple of thoughts:
1) if you want to save a layer separately, the easiest way i know of to do that is to click on the layer in the layers, channels, and paths dialoge, drag it to the toolbar, and it will create a new image with just that layer.

Cool!

2) to move the different colored text to a different layer and keep it in the same spot, i would do the following: 1. use the select contiguous regions tool, select the red letters 2. hit ctrl-c to copy, then ctrl-k to clear whats in the selection 3. create a new layer
4. right click on the image and choose Edit>Paste Into

That seems like the best approach so far.

Thanks! Eric