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

Subtracting an image from another image.

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.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

Subtracting an image from another image. GreenFeather 08 Oct 19:26
  Subtracting an image from another image. Steve Kinney 08 Oct 22:03
  Subtracting an image from another image. Ofnuts 11 Oct 12:46
GreenFeather
2014-10-08 19:26:54 UTC (over 9 years ago)

Subtracting an image from another image.

Hi, I'm fairly new to GIMP. I need help.

Let's say, I have a base image. Then another image which is comprised of the base image and a transparent layer of blue, but is merged into one layer. How can I subtract the base image from the other image, resulting in a layer of blue?

Here, I'll show what is needed in my case.

I have my base image, here

and here is the other image, which is the base image plus a rainbow layer

As I said before, the second image is one layer, and I can't click undo because that image isn't originally mine.

How would I subtract the base image from the second image that leaves me with a rainbow gradient layer, that looks something like this (image not to
scale) (note, this is just an example and I can't use this one because it does not match the exact shades of the seconds image, which is what I need)

Help please.

-- View this message in context: http://gimp.1065349.n5.nabble.com/Subtracting-an-image-from-another-image-tp43846.html Sent from the Users mailing list archive at Nabble.com.

Steve Kinney
2014-10-08 22:03:11 UTC (over 9 years ago)

Subtracting an image from another image.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

On 10/08/2014 03:26 PM, GreenFeather wrote:

Hi, I'm fairly new to GIMP. I need help.

Let's say, I have a base image. Then another image which is comprised of the base image and a transparent layer of blue, but is merged into one layer. How can I subtract the base image from the other image, resulting in a layer of blue?

Here, I'll show what is needed in my case.

I have my base image, here

and here is the other image, which is the base image plus a rainbow layer

As I said before, the second image is one layer, and I can't click undo because that image isn't originally mine.

How would I subtract the base image from the second image that leaves me with a rainbow gradient layer, that looks something like this

(image not to scale) (note, this is just an example and I can't use this one because it does not match the exact shades of the seconds image, which is what I need)

Hey GreenFeather

If I had to do the trick described above, I think I would manually reconstruct the gradient used to colorize the sample image.

First I would load up the colorized sample and the original sample in one GIMP image, original above the colorized version, and set the layer mode of the original (top layer, blue) to Divide. This gives a crude rendering of the gradient that was used to make the colorized layer. Do "New from visible" in the Layers dialog (right click on the top layer to select the option) to get a layer with the visible effect of the "divide" layer as its own native colors, so the eyedropper can pick them up:

http://pilobilus.net/xfer/gimp1/snap0.png

Then I would add a new transparent layer to create an eyeball-calculated gradient on, with guide lines (dragged in from the top & side rulers) as shown: Horizontal guides centered on the middle of the color bands, and a vertical guide as shown to keep things neat. The guides make it easy to select a series of precisely placed rectangles, to limit the effect of drawing gradients on the transparent layer to one region at a time:

http://pilobilus.net/xfer/gimp1/snap1.png

Next I would zoom in on the upper right rectangle made by the grid lines, and use the eyedropper to set the foreground and background colors to match the unmixed colors in the middle of the crude gradient in the "new from visible" layer. Then I would click on the transparent layer to make it "current", select the Gradient tool (in default configuration as shown here), and click and drag straight up along the vertical dividing line. Keep re-doing the gradient until it looks right, example:

http://pilobilus.net/xfer/gimp1/snap2.png

Next, I would make the crude new-from-visible layer current again, switch the color selector's current foreground and background colors (tiny arrow at lower left of color swatches in toolbox), and use the eyedropper to pick up the next color for my new gradient.

Make the transparent layer current, select a rectangle between the top and 2nd horizontal guide lines, and match the sample gradient as well as possible - just as you did for the first region. Repeat for every color change and we end up with a "rainbow" gradient that closely matches the original:

http://pilobilus.net/xfer/gimp1/snap3.png

In this shot, we see a comparison between the effect created by using the new gradient in Color mode (left side) to modify the blue original (middle), and the sample image made with the "unavailable" gradient (right side). The match is quite good, except that the yellow/red transition at the bottom of the new gradient needs fixed:

http://pilobilus.net/xfer/gimp1/snap4.png

Here's the resulting .xcf file:

http://pilobilus.net/xfer/gimp1/Rainbow_ark_mixed-gradient.xcf

If I wanted to make a real GIMP gradient out of this, I think I would set the manually drawn gradient to normal mode, rotate the image 90 degrees, and line up the Gradient Editor tool below the one I just made. Make 'em match and save the result as a freely re-useable gradient. I rarely have a use for the gradient editor, but it's the right tool for this job:

http://docs.gimp.org/en/gimp-gradient-dialog.html#gimp-gradient-editor-dialog

:o)

Steve

-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux)

iQIcBAEBAgAGBQJUNbSeAAoJEDZ0Gg87KR0LZhgP/R3ctorcNBEW1gb1J4MIwT1a 3/6B96AsumZXArNFy6RNgzKJfa24mGHfifbS7x8K+vyQHHX8Bz877boq4zkgg3jC FXsFUl9pZTUHA5tcw08XqrxX43lTsQ4ZEVLPpZhJMt4ICG8LSw8Wx6hKeCPXadEM 7xkN3jWKxNc9/wGS7uyUh1o4f0C77VZfCnKZp5arGICK3nCWUE/Rsu1dtt6C4ew9 s5BGiZdCEr5ZMVfZevmrea+R1KYBjj1EAUsKcl1mTZ6lB4+EmWb5nJgmBHggtso8 mb23CyadSsr5DWIrOY02MNGOtsCzkiU3fcf0OoCzGEfHofBpkNxMwKza1IH0HsKV kX1p8XMtfHKwdMfM1gfwufa52trLy2WdB5S36BmZe0VVsHrcJy0+q9vWHMj4ls1T AdMhDVsX/tJzMOEi/r9nWdOM/vfu+/iKJobnoVlYF6PQYJclgjt60OorIHFfjPR+ 3HsCqAWRoy/ZZwrbMtGv2jY3iAfAoy3ufuEBjf6Cmvew6ohqZOWsn+9XmkH+asaQ bvpC2H/CAcVA00uJQ4En2z2A2dc08OgveZh+/J3Lu9q4KGmXbrSofbbH5v+l7q2t fkUn5bSP2h3HhqtLdd6XbpqAjnvVYLiwnjdTk3lprQoNiS3bOgsBDq6ao/6Z4bvH vJebERBfxWNfFuNDHabq
=wtU2
-----END PGP SIGNATURE-----

Ofnuts
2014-10-11 12:46:53 UTC (over 9 years ago)

Subtracting an image from another image.

On 08/10/14 21:26, GreenFeather wrote:

Hi, I'm fairly new to GIMP. I need help.

Let's say, I have a base image. Then another image which is comprised of the base image and a transparent layer of blue, but is merged into one layer. How can I subtract the base image from the other image, resulting in a layer of blue?

Here, I'll show what is needed in my case.

I have my base image, here

and here is the other image, which is the base image plus a rainbow layer

As I said before, the second image is one layer, and I can't click undo because that image isn't originally mine.

How would I subtract the base image from the second image that leaves me with a rainbow gradient layer, that looks something like this (image not to
scale) (note, this is just an example and I can't use this one because it does not match the exact shades of the seconds image, which is what I need)

Help please.

This coloring is usually applied using some form of multiplication:

final=original X colors

so to get back at the colors:

colors= final / original

So in Gimp:

- Load rainbow-ed image - Load original image as a layer over it - Put original image layer in "Divide" mode

Result not perfect, due to overflow/clipping...