summaryrefslogtreecommitdiff
path: root/src/image_processor.hh
blob: 551ac4faa830180b77faa4a4e1c2732a38fa017e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef IMAGE_PROCESSOR_HH
#define IMAGE_PROCESSOR_HH

#include "colour.hh"
#include "image_loader.hh"
#include "io.hh"
#include "spawner.hh"

#include <filesystem>
#include <memory>
#include <optional>

namespace image_processor {

[[nodiscard]]
std::expected<Size, ImageLoadError> peek(Process& process,
                                         std::filesystem::path const& path);

[[nodiscard]]
std::expected<std::unique_ptr<Image>, ImageLoadError> load(
    Process& process, std::filesystem::path const& path, Image::Format format,
    uint32_t max_width = 0, uint32_t max_height = 0,
    std::optional<Colour> background = std::nullopt);

int run(std::unique_ptr<io::Reader> reader, std::unique_ptr<io::Writer> writer);

}  // namespace image_processor

#endif  // IMAGE_PROCESSOR_HH