1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to put masks in each colour channels?

Discussion in 'General GIMP help' started by drpeppercan, Apr 19, 2015.

  1. drpeppercan

    drpeppercan New Member

    Joined:
    Apr 19, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Hi all!

    I need to create a PNG file containing masks stored in its colour channels. These masks will be used by a game engine (UE4).
    The question is: How to get those masks in their corresponding channels?
    It has been advised to use Decompose to separate the colour channels, and while separated one can edit them. Then once done, you put the 3 RGB channels back together with either Recompose or Compose. The problem I have with this method is that after I define what the masks should look like for each colour channel, and put it together, each of the colour channels show the same thing, just in their respective colours of course. Basically as if nothing was done.

    I attached the a PNG file (from the original TGA), if you inspect it you'll see how each colour channel stores a different mask.

    Thanks in advance guys [​IMG]

    T_Chair_M.png
     
  2. Sydney

    Sydney New Member

    Joined:
    Apr 18, 2015
    Messages:
    7
    Likes Received:
    4
    Trophy Points:
    3
    It's difficult to recreate the problem without seeing the xcf, but here's what I tried to save masks to channels:

    1) Opened an image (JPG) in GIMP. (Did not flatten or add alpha channel etc)
    2) Colors > Components > Decompose to RGB with layers. You should now have 2 images; leave them both open.
    3) On the "decomposed" (black-and-white) image: make whatever changes you want to the individual layers. Then Colors > Components > Recompose.
    4) The last step should have automatically edited the original image (as long as it was left open). Now export the original image as PNG without flattening. If you check the channels of the original image, it should also show your edits.

    If this is unclear, I can post screencaps...
     
  3. drpeppercan

    drpeppercan New Member

    Joined:
    Apr 19, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Hi Sydney,

    Thanks a bunch for replying.
    That's exactly what I have been doing. Mind you, Recompose is not doing a thing, even though the original file is still open. Reason why I use Compose instead. But at the end it simply brings all the layers together without keeping my edits :(

    DPC
     
  4. Seloquin

    Seloquin New Member

    Joined:
    Apr 18, 2015
    Messages:
    24
    Likes Received:
    5
    Trophy Points:
    3
    Gender:
    Male
    i tried the steps and works for me, if your having issues maybe try reinstall gimp or make sure you have the latest stable version.
     
  5. Sydney

    Sydney New Member

    Joined:
    Apr 18, 2015
    Messages:
    7
    Likes Received:
    4
    Trophy Points:
    3
    Hm...yeah, it could be a version thing. I'm on 2.8.10.
     
  6. drpeppercan

    drpeppercan New Member

    Joined:
    Apr 19, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Thanks for joining us Seloquin :)
    I did uninstall the previous one along with GimpShop just in case. Then I did reinstall the latest version. But no difference :(. Still using Recompose does nothing (and the original file is open while I use it).
    I attached a ZIP file with 3 XCFs. The original, the Decomposed, and the Composed.

    I hope we solve this mystery :confused:

    DPC
     

    Attached Files:

  7. Sydney

    Sydney New Member

    Joined:
    Apr 18, 2015
    Messages:
    7
    Likes Received:
    4
    Trophy Points:
    3
    Looks like the transparent background was the issue. :) I tried this on the original xcf:

    1) Decomposed to layers with RGBA.
    2) On the decomposed: Edited the blue layer, to be like the one you attached. Then filled in the transparent part of the blue layer with black. Recomposed.
    3) The original image now shows the edits, and the muffin is more of a yellow/mustard color.

    I think the channels needed some color to interpret as transparency, and according to the docs, it's black.

    EDIT: Ha, saulgoode on Gimpchat beat me to it! I promise I was not quoting him. :)
     
    Last edited: Apr 20, 2015
    drpeppercan likes this.
  8. Seloquin

    Seloquin New Member

    Joined:
    Apr 18, 2015
    Messages:
    24
    Likes Received:
    5
    Trophy Points:
    3
    Gender:
    Male
    haha yeah that explains it all and Sydney your correct.

    okay ill explain, when you make an image, you have RGB, an image with an alpha channel is RGBA, your image is RGBA, this is visable because your image has some transparancy showing.

    when you decompose and start editing the colours your actually editing their layermask, its like having 3 layers completely filled; one red, one blue, one green, with each layer having a layer mask, which when you edit your showing/hiding more of the colour, black being transparancy, white opacity (more visable), your saying, i want more or less of this colour here, does that make sense?

    the reason why your edits arent showing when you recompose, is because your Alpha channel, is set to 100% transparent in the areas your making your changes. so you may for example of added more red outside the bounds of the original image, but you wont see it because that area where you made changes is set to 100% transparent.

    to fix this, decompose to rgba and make the Alpha channel 100% visable or at least the area's in the alpha channel that you need visable, that way when you recompose you will see all the changes you've made.

    to make all the alpha channel visable; select the Alpha mask, press the del key, and bucket fill white.

    if you need to only make part of the image transparent, couple of ways you can do this, the simplest being; follow the above steps, recompose, selection tool [select by colour] > select the black > delete.

    hope that's helped
     
    drpeppercan likes this.
  9. drpeppercan

    drpeppercan New Member

    Joined:
    Apr 19, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    This is GREAT!
    Thank you both for solving this long and annoying mystery! :)

    Btw, Seloquin, Ofnuts from GimpForums.com advised not to bother uninstalling/reinstalling as Gimp does not use the Windows registry (of course, assuming one is using Windows, like me). I thought you would like to know.

    Finally I can move on!

    DPC
     
  10. Seloquin

    Seloquin New Member

    Joined:
    Apr 18, 2015
    Messages:
    24
    Likes Received:
    5
    Trophy Points:
    3
    Gender:
    Male
    good to know, thanks :)
     

Share This Page