| # Image Detection Bypass Utility | |
| Circumvention of AI Detection β all wrapped in a clean, user-friendly interface. | |
| --- | |
| ## Screenshot | |
|  | |
| ## Features | |
| - Select input, optional auto white-balance reference, optional FFT reference, and output paths with live previews. | |
| - **Auto Mode**: one slider to control an expressive preset of postprocess parameters. | |
| - **Manual Mode**: full access to noise, CLAHE, FFT, phase perturbation, pixel perturbation, etc. | |
| - Camera pipeline simulator: Bayer/demosaic, JPEG cycles/quality, vignette, chromatic aberration, motion blur, hot pixels, read-noise, banding. | |
| - Input / output analysis panels (via `AnalysisPanel`) to inspect images before/after processing. | |
| - Background worker thread with progress reporting and rich error dialog (traceback viewer). | |
| - Graceful handling of `image_postprocess` import errors (shows a critical dialog with the import error). | |
| --- | |
| ## Quick start | |
| ### ComfyUI Integration | |
| Use ComfyUI Manager and install via GitHub link. | |
| Or manually clone to custom_nodes folder. | |
| ```bash | |
| git clone https://github.com/PurinNyova/Image-Detection-Bypass-Utility | |
| ``` | |
| then | |
| ```bash | |
| cd Image-Detection-Bypass-Utility | |
| pip install -r requirements.txt | |
| ``` | |
| Thanks to u/Race88 for the help on the ComfyUI code. | |
| ### Requirements | |
| - Python 3.8+ recommended | |
| - PyPI packages: | |
| ```bash | |
| pip install pyqt5 pillow numpy matplotlib piexif | |
| # optional but recommended for color matching / some functionality: | |
| pip install opencv-python | |
| ``` | |
| OR | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| ### Files expected in the same folder | |
| - `image_postprocess.py` β your processing logic (export `process_image(...)` or compatible API). | |
| - `worker.py` β Worker thread wrapper used to run the pipeline in background. | |
| - `analysis_panel.py` β UI widget used for input/output analysis. | |
| - `utils.py` β must provide `qpixmap_from_path(path, max_size=(w,h))`. | |
| ### Run | |
| ```bash | |
| python run.py | |
| ``` | |
| If `image_postprocess` cannot be imported, the GUI will show an error explaining the import failure (see **Troubleshooting** below). | |
| --- | |
| ## Using the GUI (at-a-glance) | |
| 1. **Choose Input** β opens file dialog; sets suggested output path automatically. | |
| 2. *(optional)* **Choose Reference** β used for FFT/color reference (OpenCV-based color match supported). | |
| 3. *(optional)* **Choose Auto White-Balance Reference** β used for auto white-balance correction (applied before CLAHE). | |
| 4. **Choose Output** β where processed image will be written. | |
| 5. **Auto Mode** β enable for a single slider to control a bundled preset. | |
| 6. **Manual Mode** β tune individual parameters in the Parameters group. | |
| 7. **Camera Simulator** β enable to reveal camera-specific controls (Bayer, JPEG cycles, vignette, chroma, etc.). | |
| 8. Click **Run β Process Image** to start. The GUI disables controls while running and shows progress. | |
| 9. When finished, the output preview and Output analysis panel update automatically. | |
| --- | |
| ## Parameters / Controls β `args` mapping | |
| When you click **Run**, the GUI builds a lightweight argument namespace (similar to a `SimpleNamespace`) and passes it to the worker. Below are the important mappings used by the GUI (so you know what your `process_image` should expect): | |
| - `args.noise_std` β Gaussian noise STD (fraction of 255) | |
| - `args.clahe_clip` β CLAHE clip limit | |
| - `args.tile` β CLAHE tile size | |
| - `args.cutoff` β Fourier cutoff (0.01β1.0) | |
| - `args.fstrength` β Fourier strength (0β1) | |
| - `args.phase_perturb` β phase perturbation STD (radians) | |
| - `args.randomness` β Fourier randomness factor | |
| - `args.perturb` β small pixel perturbations | |
| - `args.fft_mode` β one of `auto`, `ref`, `model` | |
| - `args.fft_alpha` β alpha exponent for 1/f model (used when `fft_mode=='model'`) | |
| - `args.radial_smooth` β radial smoothing bins for spectrum matching | |
| - `args.jpeg_cycles` β number of lossy JPEG encode/decode cycles (camera sim) | |
| - `args.jpeg_qmin`, `args.jpeg_qmax` β JPEG quality range used by camera sim | |
| - `args.vignette_strength` β vignette intensity (0β1) | |
| - `args.chroma_strength` β chromatic aberration strength (pixels) | |
| - `args.iso_scale` β exposure multiplier (camera sim) | |
| - `args.read_noise` β read noise in DN (camera sim) | |
| - `args.hot_pixel_prob` β probability of hot pixels (camera sim) | |
| - `args.banding_strength` β banding strength | |
| - `args.motion_blur_kernel` β motion blur kernel size | |
| - `args.seed` β integer seed or `None` when seed==0 in UI | |
| - `args.sim_camera` β bool: run camera simulation path | |
| - `args.no_no_bayer` β toggles Bayer/demosaic (True = enable RGGB demosaic) | |
| - `args.fft_ref` β path to reference image (string) or `None` | |
| - `args.ref`β path to auto white-balance reference image (string) or `None` | |
| > **Tip:** Your `process_image(inpath, outpath, args)` should be tolerant of missing keys (use `getattr(args, 'name', default)`), or accept the same `SimpleNamespace` object the GUI builds. | |
| --- | |
| ## Error handling / UI behavior | |
| - The GUI uses a `Worker` thread to avoid blocking the UI. Worker emits signals: `started`, `finished(outpath)`, `error(msg, traceback_text)`. | |
| - On error, a dialog displays the error message and a full traceback for debugging. | |
| - If `image_postprocess` fails to import at startup, a critical dialog shows the exception details; fix the module or dependencies and restart. | |
| --- | |
| ## Development notes | |
| - **Integrating your pipeline:** make sure `image_postprocess.py` exports a `process_image(inpath, outpath, args)` function (or adapt `worker.py` to match your pipeline signature). | |
| - **Analysis panels:** `AnalysisPanel` should provide `update_from_path(path)`; used for both input and output. | |
| - **Preview helper:** `utils.qpixmap_from_path` is used to load scaled QPixmap for previews β useful for keeping UI responsive. | |
| - **Packaging:** If you want a single executable, consider `PyInstaller` (note: include `worker.py`, `analysis_panel.py`, `utils.py`, and the pipeline module). | |
| --- | |
| ## Troubleshooting | |
| - **ImportError for `image_postprocess`** β ensure `image_postprocess.py` is in the same directory or on `PYTHONPATH`. Also confirm required packages (numpy, Pillow, opencv) are installed. The GUI shows the import error text at startup. | |
| - **Previews blank/no image** β check that `qpixmap_from_path` returns a valid QPixmap. The preview widget falls back to `No image` if file missing. | |
| - **Processing hangs** β confirm Worker is implemented to emit `finished` or `error`. If your `process_image` blocks indefinitely, the GUI will appear unresponsive (worker runs in background thread but won't return). | |
| - **Color matching unavailable** β color matching uses OpenCV; if you did not install `opencv-python`, the GUI will still run, but reference-based color matching will be disabled. | |
| --- | |
| ## Example: minimal `process_image` signature | |
| ```python | |
| # image_postprocess.py (sketch) | |
| def process_image(inpath: str, outpath: str, args): | |
| # args is a SimpleNamespace with attributes described above | |
| # load image (PIL / numpy), run your pipeline, save output | |
| pass | |
| ``` | |
| --- | |
| ## Contributing | |
| - PRs welcome. If you modify UI layout or parameter names, keep the `args` mapping consistent or update `README` and `worker.py` accordingly. | |
| - Add unit tests for `worker.py` and the parameter serialization if you intend to refactor. | |
| --- | |
| ## License | |
| MIT β free to use and adapt. Please include attribution if you fork or republish. | |
| --- | |