{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pathlib import Path\n",
    "from util import load_image_128, quantize_image"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Processing ../corpus/iso_ray-09_000.png...\n"
     ]
    }
   ],
   "source": [
    "corpus_dir = Path('../corpus/')\n",
    "quantized_dir = corpus_dir / 'quantized'\n",
    "\n",
    "for src_path in Path('../corpus/').glob('*.*'):\n",
    "    dest_path = quantized_dir / src_path.name\n",
    "    if not dest_path.exists():\n",
    "        print(f\"Processing {src_path}...\")\n",
    "        img = load_image_128(src_path)\n",
    "        img = quantize_image(img)\n",
    "        img.save(dest_path)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
