Hi,
I spent a sleepless night trying to edit factionīs leader portrait and his name, so I decided to write this little tutorial.
We will need ESF editor, PFM and some graphic editor (gimp is great).
First off, make a folder of some name like "my portraits" for example. Then with PFM open data.pack find ui/portraits/custom/cards and there you will see a list of portraits.tga. Choose whichever you want and right click - extract selected and point it to your folder (my portraits). Then do the same with infocard.jpg in ui/portraits/custom/info. (you dont need the picture, but its for the right path for the future pack)
The dimensions of tga file are 66x88 and the dimensions of jpg file are 204x272. So you have to cut your image respecting these dimensions. There is no need in further editing of your jpg file. But if you want to have a round portrait of your faction leader (tga file), then you have to edit it with gimp. If you want I can make a little tutorial for this as well (just write in the thread).
So lets say we have our 2 new images (one is tga - 66x88 (round or not) and one is jpg - 204x272). Name them whatever you like, but rememeber the names. Then open PFM. Create new pack file pointing to your mod folder (my portraits). Right click - add file and point to the your tga file, then the same with jpg file. Then change pack type to mode and save as for example myportraits.pack. Then copy this pack from your folder and paste it to your data folder.
In notepad write: mod myportraits.pack; and save it as user.script.txt (forget about ETW in this case). Took me as well some time to figure this out. This file save in scripts folder in document and settings.
Now comes the harder part (at least for me, took me ages to find everything in esf). with esf editor open your startpos.esf in data/campaigns/mp_eur_napoleon. We will have to make changes in 3 locations in esf! Go to this path: campaign_startpos/campaign_env/campaign_model/world/faction_array/faction_array/faction (your faction that you want to edit)/family/family monarchy info_character Here you have two names: portrait_details and campaign_localisation - we need to edit them both. So click on portrait_details. In the first line write ui/portraits/custom/cards/yourportrait.tga and in the third write ui/portraits/custom/info/yourportrait.jpg. Now click on campaign_localisation. There will be something like names_royalty_name_austriaFranz. Remember this input or change it to whatever you like, but remeber it (we will edit this in localisation.loc later)
Then go to campaign_startpos/campaign_env/campaign_model/world/faction_array/faction_array/faction (your faction that you want to edit)/character_array/character_array/character and find there your leader. (to find this out it took me a sleepless night ). But beware, he could be ranked as minister. So when you find him click further on character_details/portrait_details and change it to the same values you entered in the previous step (in family). In the first DATE you can edit the year of his birth (and so that his age). In campaign localisation is the same value as in family folder, but If you edit this in family folder, edit it here to the same value.
Then one important thing, if you want to add a number after the name of your king, you have to do this here (in character folder) find character_details and the first line and value marks his number. So if you want to have Karel IV., so write here IV.
Then the last modification in esf will be in completely different folder in startpos. Go to campaign_preopen_map_info/faction_infos/faction_infos (find your faction). In second line write the same path of tga file you wrote in family and character folder. Now save startpos. esf and follow the final step
Open local_en(or cz, de - it depends on your language).pack and find text/localisation.loc Right click extract selected and point into your mod folder (my portraits). Then make new pack, add file and point to this localisation.loc. Change pack type to movie and save. Now open localisation.loc (in PFM still) and find the array you saw in esf in family and character folder. Change the name of your leader, but do not write his number, we did this in esf already. Then save it and move the file in your data folder.
Now you can launch the game and enjoy new portraits and name of your faction leader.