--- license: mit base_model: black-forest-labs/FLUX.2-klein-9B tags: - lora - flux - flux.2 - flux.2-klein-9b - image-to-image - text-to-image - font - typography - atlas - comfyui - safetensors --- # Ref2Font V2 — Contextual LoRA for FLUX.2 Klein 9B **Ref2Font V2** is an updated **contextual LoRA** trained for **black-forest-labs/FLUX.2-klein-9B**. It generates **1280×1280 font atlases** from a single reference image "Aa". **Changes in V2:** - Fixed alignment issues (letters no longer "dance" or jump). - Increased resolution to **1280x1280**. - Improved vectorization scripts. > Disclaimer: it works **well**, but **not perfectly**. Expect occasional artifacts. ## Examples ![Example_1_C](https://cdn-uploads.huggingface.co/production/uploads/658814fd586088fd274d8cc1/0r_Q2q9sNvNXKzAgUamG-.png) ![Example_2_C](https://cdn-uploads.huggingface.co/production/uploads/658814fd586088fd274d8cc1/GQbdv0phQdc8a-lZMdnI1.png) ![Example_3_C](https://cdn-uploads.huggingface.co/production/uploads/658814fd586088fd274d8cc1/njE7tHGxaJps7KyDmnKqY.png) ## Guide The full usage, installation guide and detailed workflow live in the [GitHub repo](https://github.com/SnJake/Ref2Font): ``` https://github.com/SnJake/Ref2Font ``` ## What’s included - `Ref2FontV2.safetensors` (LoRA weights) - `Example Workflow/` (ComfyUI workflow with notes inside nodes) - `Example/` (input images and their atlases) - Post-processing scripts (`flux_pipeline.py`, `flux_grid_to_ttf.py`, `flux_upscale.py`) ## License MIT ## ComfyUI setup ### Required models 1) Base model: ``` https://huggingface.co/black-forest-labs/FLUX.2-klein-base-9B/blob/main/flux-2-klein-base-9b.safetensors ``` Place in: `ComfyUI/models/diffusion_models` 2) Text encoder (Qwen): ``` https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-9b/blob/main/split_files/text_encoders/qwen_3_8b.safetensors ``` Place in: `ComfyUI/models/text_encoders` 3) VAE: ``` https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-9b/blob/main/split_files/vae/flux2-vae.safetensors ``` Place in: `ComfyUI/models/vae` ### LoRA Download: ``` https://huggingface.co/SnJake/Ref2Font/blob/main/Ref2FontV2.safetensors ``` Place in: `ComfyUI/models/loras` ### ⚠️ IMPORTANT: Required Prompt To get the correct grid layout and character sequence, you **must** use this exact prompt: > Generate letters and symbols "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!?.,;:-" in the style of the letters given to you as a reference. ### Input image rules - **Strict black & white only** (no gray, no shadows, no volume) - **1280×1280** (recommended) - Follow the examples in `Example/` ## Post-processing: Atlas → TTF Use the included pipeline script to convert the atlas into a TTF. ### Example command (Windows) ```powershell python "Flux 2 Klein 9B\flux_pipeline.py" ^ --input "D:\ComfyUI_temp_nckhb_00003_.png" ^ --output-dir "G:\Flux 2 Klein 9B\test" ^ --no-upscale ^ --use-grid ^ --simplify 0.5 ^ --canvas 1280 ^ --contour-level 0.5 ^ --trace-scale 4 ^ --trace-blur 1.0 ^ --smooth-iters 2 ^ --baseline-mode auto ^ --keep-components 3 ^ --min-component-area 10 ^ --component-center-bias 0.35 ^ --cell-bleed 0.12 ^ --cell-bleed-max 32 ^ --no-auto-invert ``` ## Notes - `flux_upscale.py` is optional; you can skip it with `--no-upscale`. - If the atlas looks inverted, try removing `--no-auto-invert` or add `--invert`.