jgoenetxea
4/29/2019 - 8:25 AM

PNG image size without load all data

#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);