Downloads · 30 days
38
17% of all-time downloads
pearsonkyle/tcg-frame-removal-klein4b
tcg-frame-removal-klein4b is a image-to-image model from pearsonkyle. Use it when you need one image transformed into another. It is set up for diffusers. The card lists the license as apache-2.0.
An instruction-editing LoRA that strips the frame, text, and UI elements from trading-card images (Magic: The Gathering, Pokémon, Yu-Gi-Oh!, Digimon) and extends the artwork to a seamless full-bleed illustration.
Downloads · 30 days
38
17% of all-time downloads
All-time downloads
227
Public
Repo size
191 MB
Likes
0
Public
Click a slice to open those files.
.safetensors185 MB · 97%
From the Hugging Face model README
An instruction-editing LoRA that strips the frame, text, and UI elements from trading-card images (Magic: The Gathering, Pokémon, Yu-Gi-Oh!, Digimon) and extends the artwork to a seamless full-bleed illustration.
| File | Base model | Recommended sampling |
|---|---|---|
lora_klein4b.safetensors | FLUX.2-klein-base-4B | 20–25 steps, CFG 4.0, empty negative |
The input card is passed as the control/reference image (kontext-style edit conditioning) and the prompt is the edit instruction. The instruction is game-specific — use the exact phrasing the LoRA was trained with (shown with each example below).
Cards come in a variety of aspect ratios and the LoRA was trained at each card's native size, so generate at the input image's own dimensions (rounded down to a multiple of 16) rather than a fixed resolution. A subset of the training pairs was padded to a portrait / 9:16 ratio, so padded inputs are handled as well.
import torch
from diffusers import Flux2KleinPipeline
from diffusers.utils import load_image
pipe = Flux2KleinPipeline.from_pretrained(
"black-forest-labs/FLUX.2-klein-base-4B", torch_dtype=torch.bfloat16
)
pipe.load_lora_weights("lora_klein4b.safetensors")
pipe.enable_model_cpu_offload() # fits in 16 GB VRAM
card = load_image("mtg_card.png")
width, height = card.width // 16 * 16, card.height // 16 * 16 # match the card's own size
prompt = (
"Remove the title, mana cost, type line, rules text box, power and toughness, "
"and set symbol. Paint over those areas with a natural continuation of the "
"existing artwork."
)
image = pipe(
image=[card],
prompt=prompt,
guidance_scale=4.0, # true CFG with an empty negative prompt
num_inference_steps=20,
height=height,
width=width,
generator=torch.Generator("cpu").manual_seed(42),
).images[0]
image.save("full_bleed.png")
For the other games, swap the prompt for the matching instruction below.
All examples are held-out validation cards (not in the training set), generated at 20 steps, CFG 4.0, empty negative, 848×1184.
Prompt:
Remove the title, mana cost, type line, rules text box, power and toughness, and set symbol. Paint over those areas with a natural continuation of the existing artwork.

Prompt:
Remove the card name, HP, energy type icons, attack names and damage, weakness, resistance, retreat cost, set number, and illustrator credit. Paint over those areas with a natural continuation of the existing artwork.

Prompt:
Remove the card name, attribute icon, level stars, card type line, ATK and DEF values, effect text box, and outer card border frame. Paint over those areas with a natural continuation of the existing artwork.

Prompt:
Remove the card name, level indicator, attribute icon, type bar, DP value, play cost, digivolve costs, effect text box, and card border. Paint over those areas with a natural continuation of the existing artwork.
