Here is how to do this with GIMP (I learnt it yesterday).
1) Downloaded GIMP palettes from here :
https://github.com/denilsonsa/gimp-palettes/tree/master/palettes
2) Put them in the palettes folder.
If you do not know what this folder is, open GIMP then go to Edit -> Preferences -> Folders -> Palettes.
On Linux, with GIMP 2.10, I can tell you the default path is : /home/userName/.config/GIMP/2.10/palettes
3) Open GIMP, open the image you want to modify.
4) Go the menu : Image -> Mode -> Indexed.
5) Select "Use custom palette", then select the palette you want to use. Click on the "convert" button.