Will This Selfie Make a Good Malfoid AI Portrait? A Pre-Upload Photo Checker in Python (Face Count, Size, Sharpness, Exposure)
说明与用途
Python脚本检查自拍是否符合Malfoidai.com的照片要求(尺寸、格式、单人正面、光照、锐度、邮票测试),以避免糟糕的肖像和退款。
问题
Clients need to ensure a selfie meets strict photo requirements before paying for a Malfoid AI portrait, otherwise the portrait may be poor or refunded.
结果
The checker validates all studio requirements in under a second, preventing costly portrait failures and refunds.
工作流
- 1. Create a virtual environment and install dependencies:
python3 -m venv .venv && . .venv/bin/activate && pip install "opencv-python-headless<5" pillow numpy - 2. Run the checker:
python3 selfie_check.py my_selfie.jpg - 3. The script reports OK or FAIL for each rule (file size, format, face count, face size, sharpness, exposure, stamp test).
- 4. If any check fails, correct the photo (e.g., retake, adjust lighting, crop) and re-run.
- 5. Once all checks pass, upload the photo to Malfoidai.com for portrait generation.
证据
The studio's own photo guide puts it as "one clear, front-facing photo of one adult with the whole face visible, in even light and without a heavy filter. JPEG, PNG or WebP up to 10 MB."
The script below is mine and runs locally. It doesn't upload anything.
Pin OpenCV below 5. In the 5.0 wheel I tried, cv2.CascadeClassifier is gone from the main module, and the script fails at import.
- 记录日期: 2026-11-03T11:14:04.582Z