Page 1 of 1
Creating outlines with GIMP
Posted: Sun Dec 15, 2024 11:45 am
by Schlonz
Hi all,
I would like to show you a quick way to create outline files (.BIT) with GIMP 2.10.38.
Maybe this has been described before, but if so, I haven't found anything.
- open the Upxxxxxx.BMP (without shadows) with GIMP
- Select -> By Color -> click on the background
- Select -> Border (1px, Border style: hard) -> OK
- Select -> Invert
- Edit -> Clear (or press DEL key)
- File -> Export As... -> in this example Op149019.bmp
- File -> Close view -> Discard Changes
- File -> Open Recent -> select the Op149019.bmp
- use Bucket Fill (white) to remove the rectangular "frame" around the image
- use Bucket Fill (black) to change the color of the 6 seperate unit outlines
- Image -> Mode -> Indexed... -> Use black and white (1-bit) palette
- File -> Overwrite Op149019.bmp
- File -> Quit -> Discard Changes
- now rename the file from BMP to BIT and your done
If you're used to this procedure, you'll create perfect BIT file in 2 minutes or less.
Re: Creating outlines with GIMP
Posted: Sun Dec 15, 2024 12:16 pm
by Schlonz
Ingame view

Re: Creating outlines with GIMP
Posted: Tue Dec 31, 2024 1:46 pm
by Crossroads
Oh, I had missed this post, thanks a ton, Schlontz! I will try to see if GIMP Python API supports these features you describe, if so, I can write a tool that integrates to GIMP Menu. "Create BIT Outlines", in one click. Wish me luck!
Re: Creating outlines with GIMP
Posted: Wed Jan 15, 2025 4:06 pm
by Crossroads
Hello Schlonz
I had not done any Gimp Python coding for a few years, it is a bit peculiar environment to debug, especially, but here we go. Good practice!
Download the zip file, unzip, and place cslegion_create_3D_unit_bit_file.py at your Gimp plug-ins folder, which may be hidden ie. you need to unhide folders in your File Explorer.
My GIMP plug-ins are at C:\Users\[
MYUSERNAME]\AppData\Roaming\GIMP\2.10\plug-ins
Once you fire up, you should find a new entry at your Tools folder, not all of these, just the 5a entry.
- Open a unit image and run it. It saves a BIT file in the same folder having changed the name with *_BIT.bmp pattern.
- Hit Undo once to restore your original image.

- Gimp5a.jpg (232.48 KiB) Viewed 365 times
Go to your image folder, open a Power Shell command promp there, and paste and run this command to rename the bmp files to bit files:
Code: Select all
Dir *_BIT.bmp | Rename-Item -NewName { $_.Name -replace '_BIT\.bmp$', '.bit' }
Should this work (I haven't really had time to test this in game), let me know. I can then code the 5b variant which would read all 3xs files in a temp folder and create a *_BIT.bmp out of all of them. That would truly save time, if you have plenty of outlines to create.
Re: Creating outlines with GIMP
Posted: Wed Jan 15, 2025 4:12 pm
by Crossroads
Actually, to properly rename _BIT.bmp files this should do it:
Code: Select all
Dir Up*_BIT.bmp | Rename-Item -NewName { $_.Name -replace '^Up', 'Op' -replace '_BIT\.bmp$', '.bit' }
Dir Up*_BIT.bmp selects all the files that match that pattern, and in addition to renaming the file type pattern match, "Up" is replaced by "Op"
Up249031_BIT.bmp -> Op249031.bit
Re: Creating outlines with GIMP
Posted: Wed Jan 15, 2025 4:19 pm
by Crossroads
Note that I haven't tested this in-game. GIMP Python API does not allow any parameters to Export function. I did change the Image mode to Indexed, but it still might not export it properly.
If that is the case, you can export again, manually, since the outline image remains in GIMP until Undone.
Let me know how this works for you!
Re: Creating outlines with GIMP
Posted: Wed Jan 15, 2025 4:36 pm
by Crossroads
Schlonz wrote: Sun Dec 15, 2024 11:45 am
If you're used to this procedure, you'll create perfect BIT file in 2 minutes or less.
I uploaded a newer zip file to my post, this should shave off a few tenths from the process.
Procedure duration is now down to 2 seconds, more or less

Re: Creating outlines with GIMP
Posted: Wed Jan 15, 2025 4:40 pm
by Schlonz
I just did a test with the "old" version, worked like a charm....excellent.
Re: Creating outlines with GIMP
Posted: Wed Jan 15, 2025 6:00 pm
by Crossroads
Schlonz wrote: Wed Jan 15, 2025 4:40 pm
I just did a test with the "old" version, worked like a charm....excellent.
Excellent indeed! Thank you for providing the step-by-step guideline for us GIMP users, it was not too difficult to do the Python code with that available.
Paul "papalarazu" Hill who created the unit image templates for Vietnam used PhotoShop Pro as his graphics editor of choise. PSP comes with a proprietary script language as well, Paul created scripts for first turning the old "shadow mesh" unit images to use the "shadow blob" standard we now use, then for removing those blobs for the 3Dxs versions, and indeed for creating outlines from the 3Dxs versions. I am not familiar with PSP scripting language, and was very happy to use his for the little need that I had.
But, as GIMP user, this is much better. I will create the folder version of this over the weekend, the difference being that you would simply choose a folder with 3Dxs images, and the Menu command would automatically convert outlines from all bitmaps there. Quite useful if there's a larger number of images to convert from.
Re: Creating outlines with GIMP
Posted: Thu Jan 16, 2025 4:59 pm
by Crossroads
Crossroads wrote: Wed Jan 15, 2025 4:36 pm
Procedure duration is now down to 2 seconds, more or less
Well no, it isn't. There's the manual step to rename the created bmp to bit.
But since I have Python available inside GIMP, I should be able to do the file rename with the Python "os" library import even if I can't export the file properly under the GIMP API.
And I was. Added a timer for the fun of it. Now it truly clocks under two seconds:

- Gimp5a_v2.jpg (279.9 KiB) Viewed 309 times
Do note that there really isn't much error handling. If you for instance run this again, and the bit file already exists, it fails I think. Look for the outlined console message declaring steps 1 to 10 all succesful.
Version 2 of the GIMP script available below:
Re: Creating outlines with GIMP
Posted: Mon Jan 20, 2025 5:40 pm
by Crossroads
Crossroads wrote: Wed Jan 15, 2025 6:00 pm
I will create the folder version of this over the weekend, the difference being that you would simply choose a folder with 3Dxs images, and the Menu command would automatically convert outlines from all bitmaps there. Quite useful if there's a larger number of images to convert from.
Here you are, Schlonz. The folder version suggest C:\Temp as the working folder, as I am lazy. You can select other folder as well there.
I noticed GIMP does not like the old 8bit color depth unit images, but likelyhood of having those in 3Dxs versions should be very low. We prefer 24bit versions, so I won't try to figure out how to fix this. Likely, I could add a first step that creates a duplicate with proper Image mode, but I don't have the time at the moment.
This zip file with latest versions for both Create Outline GIMP scripts. Let me know if you spot anything!