GIMP Plugin: Icon Sheet Export

GIMP Plugin: Icon Sheet Export 1.0

Troller0001

I've anxiously awaited your arrival!
Joined
Mar 9, 2016
Messages
755
Location
The Netherlands
As the sane person I am, I decided to spend several hours to automate a repetitive 5-minute task.

---

Recently, someone linked a Reddit thread asking for an easy way to export icons to a set of predetermined sizes. The GIMP plugin posted there as a reply allowed exporting to .dds as well, which was useful. However, it only allowed exporting to dds with the default export settings, which unfortunately don't actually work for civ 5 icon sheets. So, lo and behold, this variant (using the one linked in the Reddit thread as a rough base) does work for civ 5, and even adds in some neat extra little features!

---

Exporting icon sheets for civ 5 is repetitive and takes some time. After making the sheet, you'll need to crop it, merge all the layers, create a layer mask, resize it to the relevant size, export it with a changed name, and repeat. Furthermore, there are many export options for dds (the image format required for civ 5), while only a few of these options actually work in-game! Add in some extra requirements for compression to work properly and you've got a cocktail of places to easily make mistakes in.

This plugin aids in exporting icons in the correct format to the sizes required for them to work in-game. It supports sheets with multiple layers, and ignores hidden layers.

Features
  • Specify Icon Size of the base sheet
  • Choose Export Filename & Directory
  • Select Icon Sizes to export to
  • (optional) Compress Icon Sheets
  • (optional) Generate IconAtlases
  • (optional) Resize Icon Sheets

Resource Thread with Installation Instructions: https://forums.civfanatics.com/resources/gimp-plugin-icon-sheet-export.28959/

Spoiler Usage :

The icon atlas used for this example originates from my Whomp's Fortress Civilization. The IconAtlas used as a base can be found in this resource: https://forums.civfanatics.com/resources/icon-atlas-templates-for-the-gimp-xcf-format.15498/

icon_sheet-png.600656

Icon sheets can consist of multiple layers. Hidden layers will be ignored during exporting. Sheets do not need to be cut out to their minimal format.

menu-png.600657

The export menu can be found under File > Export Civ5 Icons...

export_sheet-png.600658

The export menu.
Options:
  • Icon size: Represents the current icon size of the sheet. Usually, icons are made in 256px format (as that's the largest size needed for civ 5). Defaults to 256.
  • Export Name: The name used as a prefix for the exported files. E.g. an exported 32px icon sheet will have a filename of TRL_WhompIconAtlas_32. Defaults to the filename of the GIMP file.
  • Icon Sizes: Icon sizes to generate sheets for. Defaults to [32, 45, 64, 80, 128, 256].
  • Generate IconAtlas: Whether to generate an entry in the <IconTextureAtlases>-table. Supports both XML and SQL. Default: Do not generate.
  • Compress Icon Sheets: Whether to compress icon sheets. If enabled, compresses using the BC2 / DXT3 algorithm. If the icon sheet size does not permit compression, that sheet will not be compressed. Compression significantly lowers file size, but also lowers icon quality. Default: Enabled.
  • Upscale sheet dimensions to multiple of 4: If enabled, ensures that icon sheet dimensions are a multiple of 4, which will always allow compression to occur. Default: Enabled.
  • Resize icon sheet: Whether to cut the icon sheet to use the icons per row/column set below. Default: Disabled.
  • Icons per Row: The icons per row.
  • Icons per Column: The icons per column.
export_sample_45-png.600660

Exported icon sheets look as follows. This one is for 45px icons, was compressed, and had its sheet dimensions changed (135x90 to 136x92) to allow compression.
result_compressed-png.600661

In-game result (compressed)

result_uncompressed-png.600662

In-game result (uncompressed)

Spoiler Generated XML/SQL :

Generated XML
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generated by TRL-export-civ5 on 2021-06-25 09:32:06 -->
<GameData>
    <IconTextureAtlases>
        <Row>
            <Atlas>TRL_WHOMPICONATLAS</Atlas>
            <IconSize>32</IconSize>
            <Filename>TRL_WhompIconAtlas_32.dds</Filename>
            <IconsPerRow>3</IconsPerRow>
            <IconsPerColumn>2</IconsPerColumn>
        </Row>
        <Row>
            <Atlas>TRL_WHOMPICONATLAS</Atlas>
            <IconSize>64</IconSize>
            <Filename>TRL_WhompIconAtlas_64.dds</Filename>
            <IconsPerRow>3</IconsPerRow>
            <IconsPerColumn>2</IconsPerColumn>
        </Row>
        <Row>
            <Atlas>TRL_WHOMPICONATLAS</Atlas>
            <IconSize>80</IconSize>
            <Filename>TRL_WhompIconAtlas_80.dds</Filename>
            <IconsPerRow>3</IconsPerRow>
            <IconsPerColumn>2</IconsPerColumn>
        </Row>
        <Row>
            <Atlas>TRL_WHOMPICONATLAS</Atlas>
            <IconSize>128</IconSize>
            <Filename>TRL_WhompIconAtlas_128.dds</Filename>
            <IconsPerRow>3</IconsPerRow>
            <IconsPerColumn>2</IconsPerColumn>
        </Row>
        <Row>
            <Atlas>TRL_WHOMPICONATLAS</Atlas>
            <IconSize>45</IconSize>
            <Filename>TRL_WhompIconAtlas_45.dds</Filename>
            <IconsPerRow>3</IconsPerRow>
            <IconsPerColumn>2</IconsPerColumn>
        </Row>
        <Row>
            <Atlas>TRL_WHOMPICONATLAS</Atlas>
            <IconSize>256</IconSize>
            <Filename>TRL_WhompIconAtlas_256.dds</Filename>
            <IconsPerRow>3</IconsPerRow>
            <IconsPerColumn>2</IconsPerColumn>
        </Row>
    </IconTextureAtlases>
</GameData>

Generated SQL
Code:
-- Generated by TRL-export-civ5 on 2021-06-25 09:52:33
INSERT INTO IconTextureAtlases (Atlas, IconSize, Filename, IconsPerRow, IconsPerColumn)
VALUES                  ('TRL_WHOMPICONATLAS_UNCOMPRESSED', 32, 'TRL_WhompIconAtlas_uncompressed_32.dds', 3, 2),
                        ('TRL_WHOMPICONATLAS_UNCOMPRESSED', 64, 'TRL_WhompIconAtlas_uncompressed_64.dds', 3, 2),
                        ('TRL_WHOMPICONATLAS_UNCOMPRESSED', 80, 'TRL_WhompIconAtlas_uncompressed_80.dds', 3, 2),
                        ('TRL_WHOMPICONATLAS_UNCOMPRESSED', 128, 'TRL_WhompIconAtlas_uncompressed_128.dds', 3, 2),
                        ('TRL_WHOMPICONATLAS_UNCOMPRESSED', 45, 'TRL_WhompIconAtlas_uncompressed_45.dds', 3, 2),
                        ('TRL_WHOMPICONATLAS_UNCOMPRESSED', 256, 'TRL_WhompIconAtlas_uncompressed_256.dds', 3, 2);



 
This thing is great!!! Really works well, and saves a LOT of time for modders.

Quick question: why does every icon DDS file I see have 1-2 "blank" spots on them?

Does the game not see those? Why can't you use all 64 open slots?
1741875483469.png
 
Back
Top Bottom