Skip to content

JSON Migrator to EAI2 (Python Script)

Triton Supreme edited this page Oct 9, 2025 · 8 revisions

🧰 JSON Migrator to EAI2

This Python script allows you to migrate old importer folders (used by the ExtraAssetsImporter for Cities: Skylines II) into the new split format, using template-based overrides.

It can:

  • Convert legacy surface.json, decal.json, and netlane.json files to the new Prefab.json + Material.json structure.
  • Automatically fix pink Normal Maps for surfaces.
  • Optionally convert textures to 8-bit to reduce file size (Enabled by default).
  • Share identical textures across assets by replacing duplicates with a small JSON reference.

πŸ“ Notes

  • The script automatically looks for _DefaultJson templates locally or in the default Cities: Skylines II LocalLow path.
  • If templates are missing, it will raise an error and skip conversion for that format.
  • The texture sharing step creates small .json files containing only a path property pointing to the shared texture location, to reduce disk usage.

⚑ Quick Start

# Install dependencies
pip install pillow numpy imagequant

Place the script next to your old importer folders (e.g. CustomSurfaces, CustomDecals, CustomNetLanes) and run :

python JsonMigratorToEAI2.py

πŸ“¦ Installation

Make sure you have Python 3.8+ installed, then run:

# Install required libraries
pip install pillow numpy imagequant

🧼 Uninstallation

Remove the script from your hard drive and then run:

pip uninstall pillow numpy imagequant -y

πŸš€ Basic Usage

Place the script next to your old importer folders (e.g. CustomSurfaces, CustomDecals, CustomNetLanes) and run:

python JsonMigratorToEAI2.py

πŸ“ Command-line Arguments

Argument Required Description
--format {surfaces,decals,netlanes} βœ… if using --input-dir or --output-dir Specifies which asset type to process.
--input-dir DIR ❌ Path to old importer folder (processed recursively).
--output-dir DIR ❌ Output base directory. Defaults to Surfaces, Decals or NetLanesDecal depending on format.
--fail-fast ❌ Stop the script on the first error instead of continuing.
--force-8bit / --no-force-8bit ❌ Enable or disable automatic conversion of textures to 8-bit. Enabled by default.
--force-8bit-types {_BaseColorMap,_MaskMap,_NormalMap} ❌ Specify which texture types to apply 8-bit conversion to. Defaults to all three.

πŸ§ͺ Examples

1. Convert everything automatically

python JsonMigratorToEAI2.py

2. Convert only surfaces

python JsonMigratorToEAI2.py --format surfaces

2.1. Convert only surfaces from a specific folder

python JsonMigratorToEAI2.py --format surfaces --input-dir "C:\path\to\CustomSurfaces"

3. Convert only decals

python JsonMigratorToEAI2.py --format decals

4. Disable 8-bit conversion

python JsonMigratorToEAI2.py --no-force-8bit

5. Force 8-bit conversion only on BaseColorMap and NormalMap

python JsonMigratorToEAI2.py --force-8bit-types _BaseColorMap _NormalMap

πŸ“ Expected Folder Structure

MyModFolder/ 
β”œβ”€ JsonMigratorToEAI2.py 
β”œβ”€ CustomSurfaces/ 
β”‚ └─ Category/AssetName/surface.json + textures 
β”œβ”€ CustomDecals/ 
β”‚ └─ ... 
β”œβ”€ CustomNetLanes/ 
β”‚ └─ ...

After migration, the output will look like: ( NOTE : I removed the old folder, but the script doesn't remove them)

MyModFolder/ 
β”œβ”€ Surfaces/ 
β”‚ └─ Category/AssetName/Prefab.json + Material.json + textures 
β”œβ”€ Decals/ 
β”‚ └─ ... 
β”œβ”€ NetLanesDecal/ 
β”‚ └─ ...

🧠 License

MIT License β€” Feel free to modify and distribute this script.

Clone this wiki locally