[C3C] Indexing JPG Causes Transparency in GIMP

SayHayKid

Chieftain
Joined
Oct 30, 2022
Messages
82
Any GIMP pros around? I have successfully created 4 new flags to use as race/civ icons in the civlopedia. But the last one for Ethiopia I have tried for an hour, but can't figure out. I have used different flag images from Google, but every time I convert to indexed areas become partially transparent.

I have tried converting to index with 254 colors and adding green and magenta as last to in the colormap. I have tried a couple other techniques, but no luck.

If anybody could kindly convert this to a working pcx file that will show up in the Civlopedia I would greatly appreciate it. I can scale to the smaller size.
 

Attachments

  • ethiopia-lg.xcf.zip
    79.2 KB · Views: 10
the files is .xcf... have you tried to export to .pcx
Yes. I attached the original gimp format thinking it might make it easier for somebody to figure out. I am very familiar with photoshop, GIMP is new to me. Especially the indexed images and colormap. I tried three different flag images from google. At first I cropped and resized, converted to index, added green and magenta as last two colors. It didn't work. In the civlopedia it shows up as the wrong size even though the large is 128x128 and the small is 32x32. It looks like this in the civlopedia


Spoiler Civlopedia :
Screenshot 2023-01-07 at 3.22.17 PM.png


Spoiler Civlopedia Large :
Screenshot 2023-01-07 at 3.22.34 PM.png


So, then I tried starting with a flag icon that worked (England) and pasted the Ethiopian flag on top, but the Ethiopian flag was partially transparent, blending with the England color underneath. However, the layer opacity is 100%. I tried three different flags. I tried converting to index before copying into England, I tried doing after copying. At this point I ran out of ideas and thought I'd ask for help from the few Civ3 diehards left. I am sure it is something easy, I just need to be pointed in the right direction.
 
There's a link in my signature to a tutorial I wrote on how I use GIMP to make pcx.

One key difference between GIMP and Photoshop is that the Color Maps look reversed - the transparency colors (green & magenta) go at the opposite end of the GIMP Color Map from where they are in Photoshop. Another possible problem is that you did not deselect "enable dithering with transparency" when indexing the image. Make sure that option is not selected.

If neither of those work for you, please post so here and i will try to take a look at the file. That may take a few days or so, though patience is needed. :)
 
Yes. I attached the original gimp format thinking it might make it easier for somebody to figure out. I am very familiar with photoshop, GIMP is new to me. Especially the indexed images and colormap. I tried three different flag images from google. At first I cropped and resized, converted to index, added green and magenta as last two colors. It didn't work. In the civlopedia it shows up as the wrong size even though the large is 128x128 and the small is 32x32. It looks like this in the civlopedia

So, then I tried starting with a flag icon that worked (England) and pasted the Ethiopian flag on top, but the Ethiopian flag was partially transparent, blending with the England color underneath. However, the layer opacity is 100%. I tried three different flags. I tried converting to index before copying into England, I tried doing after copying. At this point I ran out of ideas and thought I'd ask for help from the few Civ3 diehards left. I am sure it is something easy, I just need to be pointed in the right direction.
SayHayKid: From the screenshots it could look like the large and the small pedia-icons have been swapped. Regarding the transparancy-issue, it is likely caused by the transparant-index (#255 if i remember correctly) in the colormap is present in the image. From your description, you added the two last indexes after converting the image to indexed, and that's how I do it (your .pcx should be OK). Anyway, I checked the .xcf file you provided, and made a pcx file from it (attached). And check that the icon-entry for the ethiopians in pediaicons.txt points to the correct file-sizes (#ICON_RACE_ETHIOPIA or something like that). First entry is the large one, and the second is small.
 

Attachments

  • ethiopia-lg.pcx
    17 KB · Views: 10
There's a link in my signature to a tutorial I wrote on how I use GIMP to make pcx.

One key difference between GIMP and Photoshop is that the Color Maps look reversed - the transparency colors (green & magenta) go at the opposite end of the GIMP Color Map from where they are in Photoshop. Another possible problem is that you did not deselect "enable dithering with transparency" when indexing the image. Make sure that option is not selected.

If neither of those work for you, please post so here and i will try to take a look at the file. That may take a few days or so, though patience is needed. :)
Your tutorial was actually what I had been following. I was successful with others, not sure what held up on this one. The one step I changed as suggested by another poster was when converting the image to indexed I set max colors to 254, this leaving two free spots at the end of the colormap. Then I simply added green and magenta. That way I didn't have to rearrange the color map. That method worked on other images. I am not sue what was different.

@Jorsalfare that is what I thought, too. But I triple checked they weren't swapped. I was successful with Mali, Siam, and Khmer. I am not sure what was different this time. I'll test right now. Thanks.

Update: Doh! I see what you mean about swapped. I kept thinking it was something with the file and forgot to doublecheck my typing in the pediaicons file. I am still new to modding. There are a lot of little things to keep track of.

One thing I still don't understand. Maybe it has something to do with the nature of indexed images. But if I copy the Ethiopia flag on to a new layer of another flag icon (say England), there is still transparency with the Ethiopian colors blending with the England colors. But blend mode is normal and the layer has no transparency. I should be able to copy a new graphic over the top of an existing as a new layer and then flatten. Hmmm. Anyhow, it is working. Thanks to you both.
 
Last edited:
One thing I still don't understand. Maybe it has something to do with the nature of indexed images. But if I copy the Ethiopia flag on to a new layer of another flag icon (say England), there is still transparency with the Ethiopian colors blending with the England colors. But blend mode is normal and the layer has no transparency. I should be able to copy a new graphic over the top of an existing as a new layer and then flatten. Hmmm. Anyhow, it is working. Thanks to you both.
Assuming you mean adding an indexed image as a new layer to another indexed image: This works well only when the two images has the same palette (the selection of colors in the colormap). If they have different colors in the colormap, Gimp will look at the colormap of the target image and pick the colors that is the closest match in the pasted image (the new layer). If the two colormaps differ too much, the result can be ugly and garbled - and possibly also result in transparent pixels. The best way to merge two indexed images with different colormaps is to first convert both to RGB, merge them, flatten, and then re-index the resulting image.
 
The one step I changed as suggested by another poster was when converting the image to indexed I set max colors to 254, this leaving two free spots at the end of the colormap.
There's a reason I specifically said in the tutorial to make sure to change the number of colors to 256. And why I pointed out several ways to ensure that the two transparency colors are included in the colormap. Might have something to do with my prior experience on multiple projects - been making pcx since waaay back in 2007 - of having problems when I don't. Just saying. ;)

. There are multiple ways to create pcx. Other methods of creating pcx with GIMP are equally valid. While you are learning it's worthwhile sticking with one method all the way through. If someone shows you a different way to create pcx with GIMP - clearly laying out all the steps from beginning with source image all the way through to a pcx that works ingame - then stick with their method. At least until you have enough experience to setup a creation pipeline of your own.
 
There's a reason I specifically said in the tutorial to make sure to change the number of colors to 256. And why I pointed out several ways to ensure that the two transparency colors are included in the colormap. Might have something to do with my prior experience on multiple projects - been making pcx since waaay back in 2007 - of having problems when I don't. Just saying. ;)

. There are multiple ways to create pcx. Other methods of creating pcx with GIMP are equally valid. While you are learning it's worthwhile sticking with one method all the way through. If someone shows you a different way to create pcx with GIMP - clearly laying out all the steps from beginning with source image all the way through to a pcx that works ingame - then stick with their method. At least until you have enough experience to setup a creation pipeline of your own.
I might not have explained well. I did follow your tutorial. It is great. It is just after things didn't work that I tried something else. Thanks for the help.
 
Top Bottom