0

I have an image - game map. It was generated a long time ago and not by me. I wan to reverse-engeneer this map to create my own tileset. E.g. I have a tile with grass with tree: grass with tree And I have a tile with grass only: grass

I want with GIMP to detect only difference between each pixel. If they match - make them transparent. So that I can get tree tile. So the desired result should be like this three without grass: three without grass

How can I do this with GIMP?

This works but with wiered effects: Copy grass -> paste into new layer on top of three with grass -> apply blend mode for grass layer as color erase

1 Answer 1

1

It's hard to distinguish the green "native" to the tree and the green from the grass so Color erase is going to make things a bit transparent all over.

Possible technique:

  1. Put the top layer in "Difference" mode.
  2. In the Channels list, drag the Green channel to the general area to make a copy of it
  3. Make a copy of the three+grass
  4. Add a layer mask, initialize to the copied channel
  5. Color > Invert the mask
  6. Threshold the mask (very low value)

enter image description here

If needed you can paint the mask to restore pixels.

(the layer group isn't absolutely necessary, it is only used to show what the Difference looks like)

Edit: a slighty simpler/faster workflow is to replace steps 2 & 4 by:

  • In 2., right-click the Green channel and Channel to selection
  • In 4., initialize the mask with the selection.

Also, make sure that you aren't de-selecting the Green channel in the process (which is what happened in the screenshot above). You may have to explicitly re-select it.

2
  • Thanks for reply! 1) what layer should be on top? grass or tree+grass ? 3) how to copy? right click on tree+grass layer and Duplicate Layer ? 4) Layer -> Mask -> Add Layer Mask ? What "initialize to the copied channel" means ? 6) Colors -> Threshold ?
    – Alexey Vol
    Apr 16 at 10:01
  • 1
    1) Any, "Difference" mode is commutative 3) yes, or the middle icon at the bottom of the Layers list 4) Yes, and the dialog has an "Initialize layer mask" question 6) Yes
    – xenoid
    Apr 16 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.