texproc/main.cpp
2025-07-29 13:50:15 +02:00

62 lines
2.0 KiB
C++

// proctex.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <memory>
#include "image.hpp"
#include "fix_colors.hpp"
int main(int argc, char* argv[]) {
if (argc < 2) {
std::cerr << "Usage: texproc <input_image> [output_image] [radius]" << std::endl;
return 1;
}
std::string out_path = argv[1];
out_path += "_fixed.png"; // Default output path
if (argc > 2) {
out_path = argv[2];
}
std::cout << "Input image: " << argv[1] << std::endl;
std::cout << "Output image: " << out_path << std::endl;
Image input_img(argv[1]);
Image output_img(input_img.GetWidth(), input_img.GetHeight());
int radius = 32;// std::max(input_img.GetWidth(), input_img.GetHeight());
if (argc > 3) {
radius = std::atoi(argv[3]);
if (radius <= 0) {
std::cerr << "Invalid radius value. Using default radius of 100." << std::endl;
radius = 100;
}
}
std::cout << "Processing image with radius: " << radius << std::endl;
//FixColors::Fix(input_img, output_img, std::max(input_img.GetWidth(), input_img.GetHeight()));
FixColors::Fix(input_img, output_img, radius);
output_img.Save(out_path);
std::cout << "Image processing complete. Output saved to: " << out_path << std::endl;
return 0;
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file