forked from mtusi2026/mtusi2026lab5
lab5
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#include "image_pipeline.hpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc != 3) {
|
||||
std::cerr << "usage: thumbnail_smoke INPUT OUTPUT.jpg\n";
|
||||
return 2;
|
||||
}
|
||||
try {
|
||||
std::ifstream input(argv[1], std::ios::binary);
|
||||
if (!input) return 1;
|
||||
const std::vector<std::uint8_t> bytes((std::istreambuf_iterator<char>(input)), {});
|
||||
const auto image = make_thumbnail(bytes);
|
||||
std::ofstream output(argv[2], std::ios::binary);
|
||||
output.write(image.bytes.data(), image.bytes.size());
|
||||
if (!output) return 1;
|
||||
std::cout << image.width << 'x' << image.height << '\n';
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << '\n';
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user