#include <arpa/inet.h>
// read the size values
std::ifstream in(imgFilenames[i]);
uint32_t width, height;
in.seekg(16);
in.read(reinterpret_cast<char *>(&width), 4);
in.read(reinterpret_cast<char *>(&height), 4);
width = ntohl(width);
height = ntohl(height);