git.haldean.org datahedron / master datahedron.cpp
master

Tree @master (Download .tar.gz)

datahedron.cpp @masterraw · history · blame

#include <png++/png.hpp>
#include <vector>

typedef png::image<png::rgb_pixel> image;

int main(int argc, char *argv[])
{
    std::vector<image> images;
    std::pair<size_t, size_t> img_size;

    for (int i = 1; i < argc; i++)
    {
        images.emplace_back(argv[i]);
        if (i == 1)
        {
            img_size.first = images.back().get_width();
            img_size.second = images.back().get_height();
        }
        else
        {
            size_t w = images.back().get_width();
            size_t h = images.back().get_height();
            if (w != img_size.first || h != img_size.second)
            {
                std::cerr
                    << "Image sizes don't match; first image size was "
                    << img_size.first << "," << img_size.second
                    << ", but image " << (i + 1) << " is size "
                    << w << "," << h << std::endl;
            }
        }
    }

    std::cout << "Loaded " << images.size() << " images of size "
              << img_size.first << "," << img_size.second << std::endl;
}