Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trouble erasing all colors.. Defaults to alpha = 0 instead...
#1
Hi All,

I am attempting to make a splatmap for a game. It reads all the channels. So, if Alpha = 0, but RGB = XXX, it will read the RGB color. I need to zero out all channels. Not just make the alpha channel 0.

Somehow, it works for one of my images, so I know at one point I had it working properly. I am not sure how I have messed up the eraser.  Confused  It not longer resets the color channels. It only makes Alpha = 0 causing total transparency, but the RBG values are still there.

Appreciate any guidance.

Thanks!
Reply
#2
You will have to give a more comprehensive explanation of what you are doing for my poor old brain.

1. Is this a scripting question?  if not then

"I need to zero out all channels" Is this not just removing the alpha channel?

" I am not sure how I have messed up the eraser. Confused It not longer resets the color channels. It only makes Alpha = 0 causing total transparency, but the RBG values are still there."

Does this refer to the eraser tool anti-erase option - bottom of the eraser tool options? Toggled on returns the colour, but only when there is an alpha channel.

Have you been exporting the image? Say as a png but with the save colour values from transparent pixels toggled off?
Reply
#3
Hi rich2005,

Thank you for the suggestions. Exporting with "save colour values from transparent pixels toggled off" must also mess with the alpha color, as all I get is a white color when exported to my game. I did not have the anti-eraser tool toggled - I did double check.

I found that if I first made the area black, and then erased it I was getting the correct result. Odd, that I didn't do that with the other image, and it is working perfectly.
Reply
#4
It might just be the way your game engine handles transparency.

Exporting a png saves the background colour - as in the FG/BG swatch - in the png file. Normally this makes no difference. Gimp opens either showing transparency.

Some applications will use the setting. This screenshot the two files open in Gimp and on top the same two open in a file viewer. https://i.imgur.com/t7OeClj.jpg

It might be worth a try, erase as normal and set the BG colour to black when exporting.
Reply
#5
So, after testing I figured out, its due to the nature of GIMP relying on layers to write over color values. Each color needs its own layer.
Reply
#6
(09-11-2018, 07:36 PM)JK0012 Wrote: So, after testing I figured out, its due to the nature of GIMP relying on layers to write over color values. Each color needs its own layer.

Uh? Black is (0,0,0) so if you want a pixel to be (0,0,0) just paint it black. No need for separate layers.

About your trouble above: it is true that when you erase something on a layer with an alpha channel, Gimp only makes it transparent and doesn't change the RGB values. If you want to erase to RGBA=(0,0,0,0):

- Set the background color to black,
- Remove the layer alpha channel
- Use the eraser
- Layers>Mask>Add layer mask and initialize to Grayscale copy of layer
- Threshold the mask so that anything not 0 becomes 100% opacity
- Apply the mask.

Now the holes are (0,0,0,0)
Reply
#7
(09-11-2018, 10:16 PM)Ofnuts Wrote:
(09-11-2018, 07:36 PM)JK0012 Wrote: So, after testing I figured out, its due to the nature of GIMP relying on layers to write over color values. Each color needs its own layer.

Uh? Black is (0,0,0) so if you want a pixel to be (0,0,0) just paint it black. No need for separate layers.

About your trouble above: it is true that when you erase something on a layer with an alpha channel, Gimp only makes it transparent and doesn't change the RGB values. If you want to erase to RGBA=(0,0,0,0):

- Set the background color to black,
- Remove the layer alpha channel
- Use the eraser
- Layers>Mask>Add layer mask and initialize to Grayscale copy of layer
- Threshold the mask so that anything not 0 becomes 100% opacity
- Apply the mask.

Now the holes are (0,0,0,0)

Great!
I have been long pestered by trying to definitely remove the color information from an erased background--it kept cropping up at unlikely moments to mess things--especially on the boundary of the alpha channel of the particular layer. This method ensures that, at least, one KNOWS what is there.
Thanks!
Reply
#8
(09-16-2018, 08:59 AM)carmen Wrote: it kept cropping up at unlikely moments to mess things--especially on the boundary of the alpha channel of the particular layer.
Thanks!

You are possibly using the wrong technique here. The pixels at the edge of objects are a blend of colors, the right things to do is to use Colors>Color to alpha to remove the background color and leave a partially transparent pixel.

One things I have learned over the years is that when Gimp appears to do the wrong thing it is because I'm not using the right technique.
Reply
#9
(09-16-2018, 09:20 AM)Ofnuts Wrote:
(09-16-2018, 08:59 AM)carmen Wrote: it kept cropping up at unlikely moments to mess things--especially on the boundary of the alpha channel of the particular layer.
Thanks!

You are possibly using the wrong technique here. The pixels at the edge of objects are a blend of colors, the right things to do is to use Colors>Color to alpha to remove the background color and leave a partially transparent pixel.

One things I have learned over the years is that when Gimp appears to do the wrong thing it is because I'm not using the right technique.

I dare say!
Only, try that on some of the images I start from:
- scanned cover of a book from around 1920, from gutenberg.org--if hardcover, very likely the bindind is cloth...
- scanned cover of a number of Argosy, All Story Weekly, Amazing, or other pulps of a century ago: paperback, of course, but aside from the printing methods of the time, very much handled, scratched, crumpled, when not rent in places...
Whatever amount of healing and blurring I apply to begin with, color erase/color to alpha leaves me with a wealth of unrelated pixels along the whole canvas (yes, and on my wished-for boundary too) that are ten times more difficult to dispose of than dealing with the consequences of a straight deleting of the background--with or without help of or a mask.
So, excuse me, bur I find yours to be a 'counsel of perfection': how fine if it only were practical!
Thanks!
Reply
#10
It would be practical if your post was accompanied with a picture. Without such a picture, I can only assume that the context is the same as the one from the OP, which is creating images, not working on scanned pictures.

This said, if you start a new thread with some examples, we may give better advice.
Reply


Forum Jump: