F.save sets opts.format to the file format, so the DDS / KTX layout option is pixelFormat; XBM / XPM make a C identifier of opts.name (F.save passes the file name).