You should be familiar with the Modding Basic Concepts tutorial before following this one.
In this tutorial, I'm going to show you how to add a new icon for a custom ability or item in Pillars of Eternity II: Deadfire. You must have Deadfire version 2.0.0 or later to use this functionality.
I've already created game data objects for two custom items, and I've created two PNG icons for each: a small 42x42 icon, which will be used to show the item in an inventory slot, and a large 100x100 icon, which will be used to show the item when it's being dragged, and in the detailed inspection window. Items require both icons, but abilities only need the small 42x42 icon.
To allow the game to load my large icon, all I have to do is put it in my mod folder at "<my_mod>/gui/icons/items". I can then reference it in the IconTextureLarge property of my item's game data.
Small icons work a little differently. They need to be packed into an atlas, which is a single image file that has multiple images in it. The free tool SpriteSheetPacker can build an atlas for you from your collection of small icon images.
Download SpriteSheetPacker and run it. Select "Add Images" and find all the small icon images you want to include in your mod.
Click the "..." next to "Output Image". Browse to your mod folder. Create a new folder in it called "atlases". In this folder, save the image as "ItemIcons.png". If you were adding abilities, the icons for those would need to be in a separate atlas, also in this folder, called "SpellAbilityIcons.png".
Ensure "Generate Map?" is enabled.
Now click "Build Sprite Sheet". This will create the atlas image, and also a file called "ItemIcons.txt", which tells the game about each separate icon in the atlas.
Finally, I can add a reference to the small icon in the IconTextureSmall property of my item's game data. Because the icon is in an atlas, this only needs the name of the sprite. It doesn't need any directory information.
That's it. My new item now has custom icons to use in-game.