This is a Github Copilot experiment. I have written almost nothing of this myself. I did a couple of small bugfixes and this disclaimer in the README. The rest of this repo was generated by GitHub Copilot.
I started by asking copilot to guide me through making a thumbnail CLI in Golang step by step. I gave it a small specification to start with and told it to ask me questions to make sure the result was going to be as good as possible.
It became a never ending guide, the steps of improvement never stopped. I think we started going in circles, just removing and adding about the same functionality back and forth until I managed to snap out of the loop.
I have taken the app for a test spin using three big jpeg files and a cr3, it seems to work as expected 👍🏻
Thumbnailer is a command-line tool for creating thumbnails of images. It supports various image formats and allows for parallel processing to speed up the thumbnail creation process.
- Go 1.16 or later
exiftool(for handling Canon CR3 image files)- Supported image formats: JPEG, PNG, GIF, BMP, CR3 (with conversion to JPEG)
- JPEG
- PNG
- GIF
- BMP
- CR3 (Canon RAW, with conversion to JPEG using
exiftool)
- JPEG
- PNG
- GIF
- BMP
-
Install Go from the official website.
-
Install
exiftool:- On macOS:
brew install exiftool - On Linux: Use your package manager (e.g.,
sudo apt-get install exiftoolfor Debian-based systems) - On Windows: Download and install from the official website
- On macOS:
-
Clone the repository and navigate to the project directory:
git clone https://github.com/yourusername/thumbnailer.git cd thumbnailer go build -o thumbnailer
Run the thumbnailer command with the required flags:
./thumbnailer -i /path/to/input -o /path/to/output -w 200 -f jpeg -c 75-i, --input: (required): Path to the input images.-o, --output: (required): Path to save the output thumbnails.-c, --compression: Compression level (1-100) for JPEG output (default: 75).-w, --width: Maximum width of the output thumbnails.-H, --height: Maximum height of the output thumbnails.-f, --format: Output image format (jpeg, png) (default: jpeg).-C, --config: Path to the configuration file.-p, --parallelism: Number of parallel image processing tasks (default: number of CPU cores).
You can also use a JSON configuration file to specify the options. Example config.json:
{
"input_dir": "/path/to/input",
"output_dir": "/path/to/output",
"width": 200,
"height": 200,
"format": "jpeg",
"compression": 75
}Run the application with the configuration file:
./thumbnailer -C /path/to/config.jsonThe application logs its progress and errors to processing.log in the current directory.
After processing, a summary report is saved to summary_report.txt in the output directory, detailing the processing
times and EXIF data for each image.