The map_regions.tga is the map file that controls the borders of regions and determines city and port locations on the campaign map. Map_regions.tga will be found in the data/world/maps/base folder of a vanilla installation, it may also be placed in the data/world/maps/campaign/campaign_name folder if the other map files are copied there as well.
The location of cities is set by a one black (RGB = 0,0,0) pixel. The location of ports is set by one white (RGB = 255,255,255) pixel. There can be only one city and port per region.
The colour of each region must be unique and the correct RGB colour reference for it included in descr_regions.txt.
The blue areas (mainly RGB 41,140,233) not assigned to a region represent the sea areas, please note that they do not actually determine the area of sea that will appear in the campaign map. The coastline shown on map_heights.tga will overrule the one shown on map_regions.tga if there is any mismatch. In RTW and BI - but not M2TW - a corrected_regions.tga is generated to show how game has interpreted mis-match.
The size of the map_regions.tga is used to calculate the sizes of the other map files. The maximum size under RTW/BI is 510 x 510 pixels. The height and width of the map_regions.tga must be entered in the descr_terrain.txt in the same folder.
The colour of any added region must be unique and exactly match the RGB value given for the region in descr_regions.txt.
Theoretically you can use any unique colour for a region, though some people have reported difficulties with specific colours. There is no agreed information as to whether any specific colours do not work - it is quite likely though that there could be a problem with using a colour that is very close to another.
When editing the map_regions.tga you must be very careful not to get merged colours - this will result in colours being present in the tga that are not assigned to water, city, port or known region as listed in descr_regions.txt. Merging can occur if you use wrong sort of re-size method, or wrong sort of 'brush'. In PaintShopPro use the 'pixel re-size' method and make sure brush has 'none' as texture setting, 100% opacity, density, and hardness. In PhotoShop use 'nearest neighbour' re-size option and crayon/pencil instead of brush.
If you know how many regions you should have a useful check (available in PaintShopPro and possibly other programs) is to use the 'count colours used' function. Number of colours should equal: number of regions + number of sea colours + city colour + port colour (if you have port pixels) max number of individual colours on map should never exceed 202. If it does you have either got merged colours or too many regions (see below)
The majority of the sea colour in the vanilla map_regions.tga files is RGB 41,140,233 but the separated areas of sea (Caspian, Red and Dead Seas) have very slightly different colours. Unlike for the regions the sea colours are not referenced in another text file. What the game will accept appears to be determined by hard-coding, so use of different colours is subject to experimentation. Safe colours to use include 41,140,234/235/236/237 radical changes of colour have been reported not to work.
It is now thought that the difference in colours is necessary to prevent ships in the smaller separated seas trying to find paths to the larger sea area and getting 'stuck' along the coastline facing the bigger sea area. See here for discussion. However using different colours for the separated sea areas also reduces the number of land regions you can have. The maximum number of provinces is 200 but that includes the differently coloured sea areas so:
total of (different coloured) sea areas + land regions = 200 regions max
Areas of sea that look linked on the map but are divided by a land bridge can usefully have a different coloured sea region on either side of the 'bridge', the game will also actually accept one contiguous sea with different colours within it, what that does to the patterns of ship movements is not known.