This plugin takes a Gimp layered image (or a Photoshop layered image, opened in Gimp) and a directory of nudes for each gal with base bodies in Main subdir, optional Hairs directory and whatever other layers you want.
Then each body (and whatnot) is inserted instead of corresponding layer of source image, and then it all is converted to Battlescape palette and saved into the output dir.
Note that one of layers, and therefore one of nudes subdirs should be Main and have an image for each needed output, while other dirs can only have images for some bodies. It's because plugin uses this dir to know which base bodies exist.
Name of the result is the same as the body image (with maybe different extension - plugin takes any image type and outputs ping or gif by your choice). But if output dir is named Body_<something> (such as Body_500), then output file name will be body<something>_<sourcename_without_ext>_pir.gif
I.e. if your source body files are named F1.gif, F2.gif etc, then you will get a dir of properlly named OpenXCOM-ready files.
Plugin can be called from Image menu.
Attached file release.zip contains script itself (trappingz.py, goes to %UserProfile%/.gimp-2.8/plug-ins), battlescape palette (XCOM-BattleScape.gpl.gpl, goes to %UserProfile%/.gimp-2.8/palettes), example nudes dir (all bodies from X-Piratez 0.99E.3, and two test hairdos) and an example project Zuki.xcf.
As you can see, example has clothes layer between the hair and the main body, and a diadem on the of all that top, and this order is preserved in the result images.
In theory, plugin can even work with partial opacity of some layers, though aesthetics of the result vary wildly. I have to test it more.
One minor bug: if you save as a gif with some layers hidden (instead of completely removed), result will be an animated image for some reason. I have yet to find the cause. No such problem when saving as png, naturally - hidden layers will simple not show.