Extracting Clean Wallpapers from App Screenshots with Multimodal LLMs: A Practical Guide

    This article presents a practical workflow for using multimodal large language models to remove UI overlays from app screenshots and reconstruct clean wallpapers. It explains why the task is image editing rather than image generation, then breaks prompt design into three layers: recognition, keep, and remove. It also covers window-based dynamic quota scheduling for batch processing, automated quality gates such as residual OCR detection and edge consistency checks, common failure modes with fixes, and general engineering architecture advice for productionizing the pipeline.

    1. Problem Background and Task Definition

    In learning-focused mobile applications, operations teams and content creators often need a clean version of the home screen background. The original background is usually high quality, but it is covered by UI elements: word definitions, feature entry icons, status bar information, and user avatars. A raw screenshot cannot be used as a wallpaper, and manually retouching it pixel by pixel in an image editor is expensive and does not scale.

    Handing this work to a multimodal LLM with visual understanding is a cheaper and more scalable path. The key point is that this is not about generating a new image. It is image editing and region reconstruction: the model must first understand the layout, then erase the specified regions and extend the background. Recognizing this is the prerequisite for designing the prompt.

    2. Three-Layer Prompt Structure

    A high-quality prompt should be organized in layers instead of stacking requirements into one paragraph of natural language. A recommended structure has three layers:

    1. Recognition layer (OCR and layout understanding): Ask the model to first output structured results, including the content of every text block, bounding box coordinates, icon positions, and the functional area each element belongs to. Recognizing first and editing second significantly reduces the false erasure rate.
    2. Keep layer: Explicitly list what must be preserved in full, such as the main background visual, gradients and textures, overall color tone, and composition. This layer counteracts the model’s tendency to over-create.
    3. Remove layer: List the elements to clear one by one. Typical items include the top status bar area (time, signal, battery), the word and definition text in the middle, the feature icon at the middle-right lower area, the entire bottom navigation or tool icon row, and the user avatar in the top-right corner.

    A sample prompt skeleton is shown below (pseudocode that expresses structure only and does not target any specific product API):

    1. [Recognition] List bounding boxes for all text and icons in the image, output JSON.
    2. [Keep] Preserve the main background visual, texture, color scheme, and composition; do not change perspective or lighting.
    3. [Remove] Erase status_bar, word_text_block,
    4. right_bottom_icon, bottom_icon_bar, top_right_avatar.
    5. [Reconstruct] Extend the erased regions using neighboring background texture; do not introduce new objects or new text.
    6. [Output] Resolution identical to the original, no watermark, no UI residue.

    The key lesson is this: removal items should use positional descriptions, not only semantic descriptions. Saying only “remove the icon” makes it easy for the model to erase background decorations as well. Writing “the single feature icon at the middle-right lower area of the screen” noticeably improves the hit rate.

    3. Dynamic Constraints and Call Scheduling

    When processing in batches, model services usually impose concurrency and rate limits. The engineering recommendation is to introduce dynamic throttling: use a fixed time window as the unit (for example, 90 minutes per segment), split tasks into several batches of conversations, with each batch containing two request types, “pure image understanding requests” and “editing requests that involve text-to-image calls,” and set a separate quota for each. Because editing requests consume more, the quota should be tilted toward them, while pure recognition requests should be scheduled first to cache layout structure results and avoid repeated recognition.

    1. # Pseudocode: window-based dynamic quota scheduling
    2. WINDOW = 90 * 60 # seconds
    3. quota = {"ocr_only": 12, "with_image_gen": 2}
    4. def schedule(tasks, now):
    5. bucket = now // WINDOW
    6. used = load_usage(bucket)
    7. tasks.sort(key=lambda t: t.kind != "ocr_only") # run low-cost tasks first
    8. for t in tasks:
    9. if used[t.kind] < quota[t.kind]:
    10. used[t.kind] += 1
    11. yield t
    12. save_usage(bucket, used)

    This strategy of “recognize first, edit second, and roll quota within the window” keeps throughput stable and predictable without touching service constraints.

    4. Result Validation and Quality Gates

    Model output is stochastic, so an automated validation step is required instead of trusting the result directly. Practical checks include:

    • Residual text detection: Run OCR on the output image again; if any word or number is still detected, mark it as failed and retry.
    • Edge consistency: Check whether the pixels on the four edges are continuous with the original image to avoid visible seams.
    • Resolution and aspect ratio: Ensure the output dimensions and aspect ratio match the original to prevent a second crop.
    • Color histogram comparison: If the distribution difference between the erased region and the surrounding area is too large, the reconstructed texture is unnatural.

    Failed samples enter a retry queue and automatically get stricter prompt constraints appended (for example, increasing the weight of the “no new text” description), forming a closed loop.

    5. Common Failure Modes and Fixes

    The first failure is over-erasure, where the main background visual is wiped out as if it were UI. The fix is to explicitly describe background features in the keep layer (gradient direction, subject position). The second is ghost residue, where the shadow of a semi-transparent icon remains; the fix is to include “shadow, highlight, and rounded base plate” in the remove list. The third is texture blurring, where the erased area shows a blurry color patch; this can be improved by requiring the model to “follow the direction and grain of the neighboring texture.” The fourth is composition drift, where the model regenerates the whole image; in this case, strengthen the constraint of “local editing only, global pixels unchanged.”

    6. Engineering Implementation Advice

    To productize this capability, a general architecture can be adopted: object storage for originals and outputs, a message queue to decouple the recognition and editing stages, a container platform to host stateless inference proxies, and logging services with monitoring and alerting to track failure rates and quota consumption. On cloud platforms such as Baidu AI Cloud, these capabilities are provided as standard categories, making it easy to scale elastically by peak load. It is also recommended to keep prompt version numbers and sample fingerprints for regression testing and effect tracking.

    7. Summary

    Going from a screenshot to a clean wallpaper is not about “letting the model draw an image.” The core is to decompose the task into four controllable stages: structure recognition, region preservation, precise erasure, and texture reconstruction, combined with window-based quota scheduling and automated quality gates. Once you master this method, similar needs such as UI element cleanup, asset normalization, and batch image library cleaning can reuse the same prompt and pipeline design.