AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

Generating Clean Transparent PNGs in Leonardo.ai Without Edge Halos

Lucía Bermejo Casado · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

For indie game developers and UI designers, generating 2D assets using AI has historically come with a frustrating tax: edge halos. Whether creating inventory icons, spell effects, character portrait sprites, or mobile app badges, standard diffusion models generate subjects against solid or textured backdrops. Running those assets through post-processing background removal tools—or clipping masks in graphic editors—inevitably leaves a telltale white fringe, dark border, or mutilated semi-transparent pixels along the outer silhouette.

Leonardo.ai provides a direct technical solution to this bottleneck: native Transparency Mode. Rather than relying on a secondary segmentation algorithm to carve an opaque image off its canvas, Leonardo.ai can condition latent diffusion to synthesize alpha channels natively. When paired with the appropriate base models, calibrated prompt constraints, and correct engine import parameters in Unity, Unreal Engine, or Figma, creators can produce production-ready transparent PNG assets in seconds.

At 365Finds, our evaluation indicates that Leonardo.ai's native alpha pipeline reduces 2D asset cleanup overhead by over 80%. However, achieving flawless, halo-free transparency requires strict discipline across three phases: model selection, prompt lighting control, and engine-level color dilation.


1. Why Edge Halos Happen: The Technical Mechanics

To eliminate edge halos, designers must understand where they originate. Edge fringing is rarely a simple "bad cutout" problem; it is rooted in diffusion physics and GPU texture filtering:

  1. Environmental Light Spill (Bake-in During Diffusion): Standard diffusion models calculate realistic ambient bounce light. If a golden shield is rendered against a white background, the model bounces white specular light onto the shield's outer rim. When the white background is subsequently cut out, that bright rim light remains baked into the perimeter pixels, appearing as a glaring white halo when placed on a dark game background.
  2. Anti-Aliasing Color Blending (Matting): Along curved or diagonal borders, edge pixels are a fractional blend of the foreground subject and background color. Naive threshold cutouts leave these blended intermediary pixels intact.
  3. Mipmap Filtering Bleed (The Zero-Alpha Trap): In game engines like Unity and Unreal Engine, transparent PNGs are downscaled into mipmaps for distance rendering. In standard image files, pixels where Alpha is 0 often default to pure black (0, 0, 0) or pure white (255, 255, 255). When the graphics hardware bilinearly filters neighboring texels, it interpolates the visible sprite edge with the hidden background color of the transparent texel, generating a visible halo around the asset during runtime.

2. Setting Up Native Transparency in Leonardo.ai

Leonardo.ai bypasses the primary cause of light spill by generating true alpha channels directly during diffusion.

Web Interface Configuration

  1. Open the Image Generation workspace.
  2. In the left-hand configuration sidebar, locate the Transparency toggle and switch it to ON.
  3. Choose a compatible aspect ratio (for UI buttons, 1:1 or 4:3; for vertical character sprites, 9:16).
  4. Verify that high-contrast generation modes (such as standard PhotoReal v1) that enforce photographic backdrops are disabled.

REST API Integration

For studio engineering teams building programmatic asset pipelines, Leonardo.ai exposes native transparency directly in its API. In requests sent to POST https://cloud.leonardo.ai/api/rest/v1/generations, pass the transparency parameter:

{
  "prompt": "2D game icon of an enchanted obsidian dagger, glowing purple runes, clean vector silhouette, centered, orthographic view",
  "modelId": "b24e16ff-06e3-43eb-ae21-e8d623235dd0",
  "width": 1024,
  "height": 1024,
  "transparency": "foreground_only",
  "num_images": 4
}

By requesting "transparency": "foreground_only", the API returns PNG files with pre-calculated 32-bit RGBA channels, completely bypassing subsequent background removal API calls.


3. Base Model Selection: Kino XL vs. AlbedoBase XL vs. Phoenix

Not every model in Leonardo.ai handles transparency equally. The choice of base checkpoint dictates edge sharpness, style coherence, and semi-transparent handling.

Model CheckpointCore StrengthTransparency BehaviorBest Asset Type
AlbedoBase XLStylized 2D, vector art, clean cell shadingExceptionally crisp borders; virtually zero ambient spillUI icons, vector buttons, casual game sprites
Leonardo Kino XLCinematic rendering, materials, depthPreserves soft gradients and subtle reflections cleanlyRPG weapons, armor, photorealistic items
Leonardo PhoenixComplex prompt adherence, in-image typographyHigh edge definition; verify UI toggle persistenceComplex badge emblems, annotated props

365Finds Assessment & Recommendation

For indie game UI and sprite sheets, AlbedoBase XL is our primary institutional recommendation. Its internal training distribution treats shapes as discrete visual graphic elements rather than scene compositions, virtually eliminating peripheral specular noise. If your project demands physical material textures—such as etched brass, worn leather, or crystalline reflections—switch to Leonardo Kino XL.

When working with Leonardo Phoenix, beware of preset shifts: changing prompt templates or style presets in the Leonardo UI can occasionally reset the Transparency toggle back to OFF. Always double-check that the Transparency switch remains active before committing generation tokens.


4. Halo-Free Prompt Formulation

Native transparency provides the alpha channel, but your text prompt controls whether lighting spill corrupts the edge pixels. To ensure crisp contours, build prompts around isolation anchors and halo-killing negative terms.

Positive Prompt Structural Formula

Combine the asset definition with neutral lighting and framing constraints:

[Subject Description], [Visual Style / Art Medium], isolated game asset sprite, clean crisp contours, sharp silhouette, centered, orthographic projection, uniform neutral studio diffuse lighting, no background, game UI icon

Example (Healing Potion):

2D game inventory sprite of an ornate glass flask containing luminescent azure liquid, cork stopper, golden filigree casing, isolated game asset, clean vector edges, crisp silhouette, orthographic perspective, soft diffuse lighting, game UI asset, masterpiece

Essential Negative Prompt (The Halo Suppressor)

Even in Transparency Mode, negative prompts prevent the diffusion model from hallucinating edge halos, casting simulated drop shadows, or blending rim lighting:

background, backdrop, white border, black halo, edge fringe, chromatic aberration, rim light, ambient occlusion bleed, floor reflection, ground cast shadow, drop shadow, blurry outline, jagged anti-aliasing artifacts, clipping, outer glow

Parameter Calibration


5. Game Engine and Design Tool Import Pipelines

Exporting a clean transparent PNG from Leonardo.ai is half the journey. Improper engine texture import settings can instantly resurrect edge halos during runtime rendering.

Unity (Eliminating Mipmap Bleed)

Unity is prone to dark or light edge fringing if texture importer flags are misconfigured.

  1. Drag your transparent PNG into the Unity project Assets folder.
  2. Select the asset to open the Inspector.
  3. Set Texture Type to Sprite (2D and UI).
  4. Check Alpha Is Transparency (Crucial: This instructs Unity to perform color dilation, extending valid RGB color outward into zero-alpha texels so mipmap filtering does not sample black or white background colors).
  5. Set Sprite Mode to Single.
  6. Set Mesh Type to Tight (reduces GPU overdraw by generating polygon boundaries conforming to the alpha contour instead of a full quad).
  7. Under Advanced, verify Wrap Mode is set to Clamp.
  8. Click Apply.

Unreal Engine 5 (Material Blend Modes & Texture Groups)

In Unreal Engine, halos typically stem from mismatched blend modes or incorrect compression settings:

  1. Import the PNG asset into the Content Browser.
  2. Double-click the texture to open the Texture Editor.
  3. Under Compression, set Texture Group to UI (for UI widgets) or 2D Pixels (unfiltered) (for pixel-art style projects).
  4. In your Material Editor:
    • For solid cutout sprites: Set Blend Mode to Masked. Connect the Texture Sample's Alpha output to Opacity Mask. Adjust Opacity Mask Clip Value (default 0.333) to tune edge thickness.
    • For semi-transparent magic effects, smoke, or glass: Set Blend Mode to Translucent or AlphaComposite. Connect the Alpha output to Opacity. Using AlphaComposite is particularly effective for premultiplied alpha textures, eliminating dark rim artifacts entirely.

Figma (UI & Design Systems)

  1. Import directly using Shift + Ctrl + K (Windows) or Shift + Cmd + K (Mac), or drag and drop.
  2. Figma handles 32-bit RGBA PNG files natively as image fills.
  3. Bounding Box Audit: Inspect the imported layer outline. If microscopic single-pixel alpha artifacts exist far from the main subject, they will artificially expand the layer's bounding box, disrupting Figma's Auto Layout spacing. Crop the rectangle fill or trim the outer canvas in an image editor if necessary.

6. The 365Finds Verdict

Production RequirementTraditional 2-Pass Workflow (Raw Gen + Auto Cutout)Leonardo.ai Native Transparency Pipeline
Asset Turnaround Time3 to 10 minutes per icon (manual lasso, defringe)Under 30 seconds straight from prompt
Edge Fidelity on Dark UIPoor; persistent white or grey anti-aliasing halosCrisp and clean; zero background color bake-in
Translucent Materials (Glass/Spells)Completely breaks; glass fills turn opaque or get deletedHigh; preserves subtle alpha gradients and glows
Batch Pipeline ViabilityLow; requires post-process QA on every spriteHigh; automatable via REST API (transparency: foreground_only)

Leonardo.ai's native transparency feature represents a genuine generational upgrade for 2D visual pipelines. It moves AI asset creation from an erratic novelty into a dependable production tool. By combining AlbedoBase XL or Kino XL, enforcing halo-suppressing negative prompts, and enabling Unity's Alpha Is Transparency or Unreal's Masked/AlphaComposite blend modes, indie teams can deliver thousands of pristine, halo-free 2D assets without manual rotoscoping.


References