Check this example:
  https://github.com/ComputationalRadiationPhysics/picongpu/blob/dev/src/tools/png2gas/png2gas.cpp#L56-L76