Unable to save transparent GIMP files

AnthonyBoscia

Emperor
Joined
Feb 7, 2010
Messages
1,898
Hi. I have recently found this site and the excellent resources here which describe how to add new graphics. I have downloaded GIMP and been trying to create a new units_32.pcx file since I require more space than was available in the C3C units_32 file. Although I have been able to index the file, it will not save transparency effects in pcx format. Therefore, any solid graphics (like wonder splashes) work fine, but a transparent one like the units_32 is a magenta-outlined ruin.

The program I had before downloading GIMP was Picture It, which was included in my aging computer. Does anyone know how I can save transparent files correctly? Will I need a program other than GIMP or am I missing something? Any help is highly appreciated; this is my first time attempting anything like this on a computer.


View attachment 246501

View attachment 246502
 
Only certain file types support transparency (PNG is the most common) but that is not your problem. Civ3 doesn't use real transparency, it just removes the last 2 colors in the palette from all images. When we speak of making things transparent, from the perspective of an image editor that means using the last 2 colors. Since you must have converted your file to RGB mode to enable transparency, you need to convert it back to indexed mode and put magenta and the other background color at the end of the palette, at indices 254 and 255. The way I do this is to convert the image to a 254-color palette, then add the transparency colors to the end of the palette and repaint the transparent regions with those colors.
 
Yeap, replace the transparency with the last two colours in a 256-colour palette (normally, a ghastly shade of magenta, guess it's because no one'd use such a colour in a unit), and that should be it.
Also, welcome to the forums. Remember that Apolyton is our sworn enemy. ;)
 
Hi Tony (may I call you Tony?)

Firstly, that flatten image screen is normal; press export and move on.

I usually work on a completely transparent background, sometimes with many layers. It's important when doing this to take all of the magneta out of any source image you're working with, as it won't index properly when you get to that step. There are many ways to do this, including the slow "one pixel at a time" technique that I employed when I was just learning how to do this. Nowadays, I use the Color Select Tool and click on the magneta then Cntrl -> X it out of existence. If you get a white background when you do this, you're not actually on a transparent background. Go back (Cntrl -> Z) and Select -> All, Edit -> Copy the image and then recreate it: File ->Create -> From Clipboard to get an image on a truly transparent background and then highlight and erase the magneta.

Sometimes (well, usually), there are some almost magneta colors left over; I used to remove these one by one as well, but I've learned that you can instead turn them to shadow by going to Colors -> Hue-Saturation*, and click the little white dot next to the M (magneta) then slide the saturation bar until the magneta turns grey. Now you should have a magneta-free image to paste into or use as your primary project.

When your image is ready to index, go first to Image -> Merge Visible Layers there, you want to check Clipped to Image and Discard Invisible layers.

From there, your steps are:

1. Select -> All, Edit ->Copy

2. Image -> Mode -> Indexed, click Generate Optimum Palette; Maximum number of colors: 256

3. Windows ->Dockable Dialogues -> Colormap

4. Click on the last color square on the lower right. If its number is under 256, click the + sign to add squares until there are 256 squares on the colormap. Then right-click on color #255 to bring up a little menu and click Edit Color and in that window. Change the color to neon green by changing the HTML notation to 00ff00. click OK. Then go to square #256 and change that square to magneta the same way, using HTML notation ff00ff. The good news is that Gimp will remember that you made these colors and will save them as options for later.

5. Now before you close the colormap, click one more time on the magneta square to set it as the foreground color in your toolbox.

6. By doing all this, you may have changed some colors in the image; now's the time to Edit-> paste the copy you left on the clipboard in Step 1 to return your colors to their original glory.

7. Now click on a transparent area with the Color Select Tool to highlight all of the transparent areas. Assuming that your foreground color is still magneta, Cntrl -> , (comma) will fill all of the transparent areas with magneta.

8. Now save the image as a pcx.

I find that the Hotkeys are handy. My favs are:

Cntrl -> Z = undo: repeating allows you to go back as far as you want
Cntrl -> X = erase highlighted area (sends it to the clipboard)
Cntrl -> V = paste from clipboard
Cntrl -> , = fill highlighted area with foreground color
Cntrl -> C = copy to clipboard

I hope that somewhere in there is an answer to your problem, Tony. Welcome to CFC!


*(this doesn't work on indexed images; only RGB mode)
 
Tango mike for your help and welcome! Hopefully this weekend I will have some time to work on the game, and I can let you know how it comes out. I didn't have internet access when I first got Civ 3, so I was impressed when I reloaded it recently and found all the work that people have poured into it over the years. Thanks!
 
First of all, thanks to the three of y'all for your assistance. Your directions especially, Balthasar, worked out great after a number of attempts. I still have not gotten the colors correct, though. When I view the units_32.pcx after finishing the above steps, it looks right. It also looks right in CivEdit. In the game, however, it has a completely different color palette, like a child's paint-by-numbers gone mad. I made sure to re-paste the units after indexing, as indicated in step 6 above. I'm not sure if I'm missing something when generating the palette.

I appreciate your help, especially since I've spent more time on the units roster than on the rest of my scenario altogether! I really like to get this right so I don't have to use the generic unit roster.
 
I think you can save the palette from one file as a separate .pal file (need to look up the UP forum)
and copy it to the other... never did myself but I know it's doable.
So you can just bring the palette over from a file you know works perfectly.
Here's the thread.

x-post with tom2050! Mirc would be proud of me.
 
Yea, Takhisis is right, if you paste the image into an image that has the correct palette, such as the main units_32 file which holds all the unit pcx... it will work itself out. But, if the original does not have the correct civ colors (which are the reds) then it will show up strange in game, in which it needs to have the palette fixed.

If the 2nd scenario is the case, you can post it, and I or someone can fix it.
 
1-load the original Unit_32.pcx into your GFXEditor
2-open the palette dialog and save under any name
3-close the dialog window and original pcx
4-open your own Unit_32.pcx
5-open the palette dialog and load the palette from step 2
6-close the palette dialog and save your image as pcx

Ready! Very simple ...
 
Lovely. Thanks to your generous (and quick) guidance, I got it to work. My original problem, of course, was that without a graphics program like GIMP, any attempt to add a unit unit roster ended in catastrophic mission failure when you try to open a city screen. I think the second problem was that since I was stealing other people's units for my own greedy purposes, there was too much variety in color and the palette it generated was trying to make the best of it. With the civ3 palette courtesy of PalSuite, the colors are a bit different (bolder and darker) but they look just fine in-game.

Now I can concentrate on the real work.
 
Back
Top Bottom