Update README.md
Browse files
README.md
CHANGED
|
@@ -15,17 +15,25 @@ tags:
|
|
| 15 |
- safetensors
|
| 16 |
---
|
| 17 |
|
| 18 |
-
#
|
| 19 |
|
| 20 |
-
**
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
## Examples
|
| 25 |
|
| 26 |
-
|
| 27 |
-
:
|
|
@@ -34,7 +42,7 @@ https://github.com/SnJake/Ref2Font
|
|
| 34 |
```
|
| 35 |
|
| 36 |
## What’s included
|
| 37 |
-
- `
|
| 38 |
- `Example Workflow/` (ComfyUI workflow with notes inside nodes)
|
| 39 |
- `Example/` (input images and their atlases)
|
| 40 |
- Post-processing scripts (`flux_pipeline.py`, `flux_grid_to_ttf.py`, `flux_upscale.py`)
|
|
@@ -46,7 +54,7 @@ MIT
|
|
| 46 |
### Required models
|
| 47 |
1) Base model:
|
| 48 |
```
|
| 49 |
-
https://huggingface.co/black-forest-labs/FLUX.2-klein-9B/blob/main/flux-2-klein-9b.safetensors
|
| 50 |
```
|
| 51 |
Place in: `ComfyUI/models/diffusion_models`
|
| 52 |
|
|
@@ -65,14 +73,17 @@ Place in: `ComfyUI/models/vae`
|
|
| 65 |
### LoRA
|
| 66 |
Download:
|
| 67 |
```
|
| 68 |
-
https://huggingface.co/SnJake/Ref2Font/blob/main/
|
| 69 |
```
|
| 70 |
-
|
| 71 |
Place in: `ComfyUI/models/loras`
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
### Input image rules
|
| 74 |
- **Strict black & white only** (no gray, no shadows, no volume)
|
| 75 |
-
- **
|
| 76 |
- Follow the examples in `Example/`
|
| 77 |
|
| 78 |
## Post-processing: Atlas → TTF
|
|
@@ -85,31 +96,21 @@ python "Flux 2 Klein 9B\flux_pipeline.py" ^
|
|
| 85 |
--output-dir "G:\Flux 2 Klein 9B\test" ^
|
| 86 |
--no-upscale ^
|
| 87 |
--use-grid ^
|
| 88 |
-
--vectorize contours ^
|
| 89 |
--simplify 0.5 ^
|
| 90 |
-
--canvas
|
| 91 |
--contour-level 0.5 ^
|
| 92 |
--trace-scale 4 ^
|
| 93 |
--trace-blur 1.0 ^
|
| 94 |
--smooth-iters 2 ^
|
| 95 |
--baseline-mode auto ^
|
| 96 |
-
--
|
| 97 |
-
--
|
| 98 |
-
--
|
| 99 |
-
--
|
|
|
|
| 100 |
--no-auto-invert
|
| 101 |
```
|
| 102 |
|
| 103 |
-
**Upscaler is optional.** If you want to use `flux_upscale.py`, install PyTorch separately:
|
| 104 |
-
```
|
| 105 |
-
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
|
| 106 |
-
```
|
| 107 |
-
|
| 108 |
## Notes
|
| 109 |
-
-
|
| 110 |
-
-
|
| 111 |
-
```
|
| 112 |
-
https://huggingface.co/SnJake/Ref2Font
|
| 113 |
-
```
|
| 114 |
-
- If the atlas looks inverted, try removing `--no-auto-invert` or add `--invert`.
|
| 115 |
-
- If letters look vertically misaligned, use `--baseline-mode auto`.
|
|
|
|
| 15 |
- safetensors
|
| 16 |
---
|
| 17 |
|
| 18 |
+
# Ref2Font V2 — Contextual LoRA for FLUX.2 Klein 9B
|
| 19 |
|
| 20 |
+
**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".
|
| 21 |
|
| 22 |
+
**Changes in V2:**
|
| 23 |
+
- Fixed alignment issues (letters no longer "dance" or jump).
|
| 24 |
+
- Increased resolution to **1280x1280**.
|
| 25 |
+
- Improved vectorization scripts.
|
| 26 |
+
|
| 27 |
+
> Disclaimer: it works **well**, but **not perfectly**. Expect occasional artifacts.
|
| 28 |
|
| 29 |
## Examples
|
| 30 |
|
| 31 |
+
|
| 32 |
+

|
| 33 |
+
|
| 34 |
+

|
| 35 |
+
|
| 36 |
+

|
| 37 |
|
| 38 |
## Guide
|
| 39 |
The full usage, installation guide and detailed workflow live in the [GitHub repo](https://github.com/SnJake/Ref2Font):
|
|
|
|
| 42 |
```
|
| 43 |
|
| 44 |
## What’s included
|
| 45 |
+
- `Ref2FontV2.safetensors` (LoRA weights)
|
| 46 |
- `Example Workflow/` (ComfyUI workflow with notes inside nodes)
|
| 47 |
- `Example/` (input images and their atlases)
|
| 48 |
- Post-processing scripts (`flux_pipeline.py`, `flux_grid_to_ttf.py`, `flux_upscale.py`)
|
|
|
|
| 54 |
### Required models
|
| 55 |
1) Base model:
|
| 56 |
```
|
| 57 |
+
https://huggingface.co/black-forest-labs/FLUX.2-klein-base-9B/blob/main/flux-2-klein-base-9b.safetensors
|
| 58 |
```
|
| 59 |
Place in: `ComfyUI/models/diffusion_models`
|
| 60 |
|
|
|
|
| 73 |
### LoRA
|
| 74 |
Download:
|
| 75 |
```
|
| 76 |
+
https://huggingface.co/SnJake/Ref2Font/blob/main/Ref2FontV2.safetensors
|
| 77 |
```
|
|
|
|
| 78 |
Place in: `ComfyUI/models/loras`
|
| 79 |
|
| 80 |
+
### ⚠️ IMPORTANT: Required Prompt
|
| 81 |
+
To get the correct grid layout and character sequence, you **must** use this exact prompt:
|
| 82 |
+
> Generate letters and symbols "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!?.,;:-" in the style of the letters given to you as a reference.
|
| 83 |
+
|
| 84 |
### Input image rules
|
| 85 |
- **Strict black & white only** (no gray, no shadows, no volume)
|
| 86 |
+
- **1280×1280** (recommended)
|
| 87 |
- Follow the examples in `Example/`
|
| 88 |
|
| 89 |
## Post-processing: Atlas → TTF
|
|
|
|
| 96 |
--output-dir "G:\Flux 2 Klein 9B\test" ^
|
| 97 |
--no-upscale ^
|
| 98 |
--use-grid ^
|
|
|
|
| 99 |
--simplify 0.5 ^
|
| 100 |
+
--canvas 1280 ^
|
| 101 |
--contour-level 0.5 ^
|
| 102 |
--trace-scale 4 ^
|
| 103 |
--trace-blur 1.0 ^
|
| 104 |
--smooth-iters 2 ^
|
| 105 |
--baseline-mode auto ^
|
| 106 |
+
--keep-components 3 ^
|
| 107 |
+
--min-component-area 10 ^
|
| 108 |
+
--component-center-bias 0.35 ^
|
| 109 |
+
--cell-bleed 0.12 ^
|
| 110 |
+
--cell-bleed-max 32 ^
|
| 111 |
--no-auto-invert
|
| 112 |
```
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
## Notes
|
| 115 |
+
- `flux_upscale.py` is optional; you can skip it with `--no-upscale`.
|
| 116 |
+
- If the atlas looks inverted, try removing `--no-auto-invert` or add `--invert`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|