#pragma once

#include <daguerre/image.hpp>
#include <optional>
#include <cstdio>

namespace daguerre {

  std::optional<image<rgb24>> try_load_ppm(FILE *input);

  static inline std::optional<image<rgb24>> try_load_ppm(const char *path) {
    FILE *f = fopen(path, "r");
    if (!f)
      return {};
    auto result = try_load_ppm(f);
    fclose(f);
    return result;
  }

}
