Saving image in the alpha channel?

How to save an image (black-and-white gloss map) in the alpha channel of a diffuse texture? In GIMP/Paint.NET, if possible?

I don’t know of any image-file formats that allow you to store a black and white image in an alpha channel. Panda has a way to load an image file into an alpha channel, like this:

<Texture> yadayada {
  <Scalar> format { alpha }

open gimp , open your diffuse texture,check the layer-window, right-click on the layer->add layermask. then you can edit/draw/fiew the layermask. once you finished editing you can save it as png-image.

I didn’t really get what to do.
I don’t want to draw anything, I have a black-and-white specular map texture exported from Crazybump, and a diffuse texture. Both are rgb jpgs. I need to combine them together, so that the specular/gloss map is in the alpha channel of the diffuse texture at the end. But how? :unamused:

Like this:

<Texture> YabbaDabbaDoo {
  <Scalar> alpha-filename { "image-gloss.jpg" }
  <Scalar> format { rgba }
  <Scalar> envtype { modulate_gloss }

So this loads two images into one texture. The texture is RGBA after it has been loaded. It is a modulate_gloss texture, meaning that the RGB portion is used in the regular way (modulation), and the alpha is used as a gloss map.

It gives me error:

Warning in /d/Python Projects/Training/Roaming-Ralph/models/grass2.egg at line 11, column 47:
  <Scalar> alpha-filename { "image-gloss.tga" }
Unsupported texture scalar: alpha-filename

:egg2pg(warning): Ignoring inappropriate format rgba for 3-component texture TerrainTilesColor

So, it doesn’t work. First I tried the JPG textures that were exported from Crazybump, then saved them as TGA, then added alpha channels to these TGAs, but none of these ways worked.
At the moment the texture part in the egg looks like that:

<Texture> TerrainTilesColor {
  <Scalar> alpha-filename { "image-gloss.tga" }
  <Scalar> format { rgba }
  <Scalar> envtype { modulate_gloss }
  <Scalar> uv-name { UVTex }
  <Scalar> wrapu { repeat }
  <Scalar> wrapv { repeat }
  <Scalar> minfilter { linear_mipmap_linear }
  <Scalar> magfilter { linear }


<Scalar> alpha-file { "image-gloss.jpg" }

This works. But - very weird. In the engine it looks like the diffuse texture disappears…
Here is the log:

:gobj(error): Texture::read() - couldn't read (alpha): image-gloss.jpg
:gobj(error): Texture "/d/Python Projects/Training/Roaming-Ralph/models/grass-diffuse.jpg" exists but cannot be read.

You can do that with gimp easily like TE said. Open your two images with Gimp (the diffuse texture and the grayscale gloss map). Copy your gloss image and paste it on the diffuse image to get two layers (gloss on top and diffuse bellow). Then add a layer mask to the diffuse layer and in the options chose to copy from the above layer. You can now delete the top layer and save the image to a new file.

This means there is something wrong with the jpeg file. Are you sure it’s a valid image and not truncated or anything? Can you pview just the jpeg file itself?


The image itself is fine, both of them appear fine in any image-editing and viewing software I have (Photoshop, GIMP, Paint.NET, IrfanView, Faststone Image Viewer) and in Panda (when used as diffuse texture).

I think the error message was a little confusing. I think it’s the gloss map it couldn’t read.

EDIT: Sorry, it works! I just tested it under wrong angle, and didn’t see it.

If you are interested, I have just discovered the easiest method to save a grayscale image into an alpha channel of another image.
There is a free image editor called Paint.NET ( ). You will need to put its dll into the Effects folder in the Paint.NET installation directory.

Then open the image that will contain the alpha channel, run “Effects -> Alpha Mask…”, feed the grayscale image to the program, and save your new image with the alpha channel! Really easy (actually, I more and more discover that with Paint.NET everything is easy, its their philosophy, as in Python)!