Start Here

txt2img Explained: Stable Diffusion Text-to-Image on a Phone

PhoneDiffusion
txt2img Explained: Stable Diffusion Text-to-Image on a Phone

Basics

txt2img in Stable Diffusion means text-to-image: you type a prompt, the model starts from pure random noise, and it removes that noise step by step, guided by the prompt, until a new image appears. No input photo is needed. The prompt, negative prompt, seed, size, steps, guidance (CFG), and sampler decide the result.

What txt2img means in Stable Diffusion

txt2img is Stable Diffusion's text-to-image mode. You provide a text prompt; the system encodes it, starts from a noisy latent image, and denoises it over a number of steps. A decoder (the VAE) then turns the final latent into visible pixels. No source photograph is required.

The name comes from the original CompVis reference code, which ships a scripts/txt2img.py sampler. By default that script uses a guidance scale of 7.5, 512×512 images (the size the first Stable Diffusion models were trained on) and 50 steps with the DDIM sampler; the README's example adds --plms to use PLMS.

txt2img vs img2img

txt2img starts from pure noise, so everything in the picture comes from the prompt and the model. img2img starts from an existing image that is encoded and partly re-noised, so the result keeps some of the original's layout and colors.

ComfyUI makes the difference visible with its denoise setting: the documentation describes 1.0 as complete noise and 0.0 as preserving the original input. A standard txt2img run is the 1.0 case: there is nothing to preserve.

The txt2img settings that change the result

Prompt: what you want. Negative prompt: what to steer away from; Diffusers documents it both for removing quality problems and for removing specific content. Seed: the starting noise; a fixed seed with fixed settings repeats the same image in the same pipeline. Width and height: the canvas. Diffusers notes that Stable Diffusion 1.5 defaults to 512×512 and SDXL to 1024×1024, and that going below a model's native size can lower quality. For portrait and landscape sizes per platform, see the best aspect ratios for Stable Diffusion on social media.

Steps: how many denoising passes run; ComfyUI's tutorial puts it simply: more steps mean finer details but longer processing. Guidance scale (CFG): how strictly the image follows the prompt. Diffusers explains that low values give the model more freedom and that values set too high can introduce artifacts; if colors come out flat or gray, see why Stable Diffusion colors look washed out. Sampler and scheduler: the method and spacing of the denoising steps; see Stable Diffusion samplers and schedulers explained.

PhoneDiffusion generates on-device on iPhone or iPad, with optional cloud models. Download on the App Store →

How a txt2img run is wired in ComfyUI and in code

ComfyUI's default text-to-image graph shows every stage as a node: Load Checkpoint (the model, text encoder, and VAE), two CLIP Text Encode nodes (positive and negative prompt), Empty Latent Image (the noise canvas and its size), KSampler (seed, steps, cfg, sampler, scheduler, denoise), VAE Decode, and Save Image.

In Hugging Face Diffusers the same run is a text-to-image pipeline call with a prompt plus optional negative_prompt, height, width, num_inference_steps, guidance_scale, and a seeded generator for reproducible results. Desktop web UIs expose the same controls on a txt2img screen.

How to run a useful first txt2img test

Choose one model at its native size (or the fixed size of a phone pack) and the app's recommended preset. Write a prompt with one subject, one action, a clear environment, a medium, light, and framing. Generate one image and save its settings, plus the seed if your tool shows it.

In tools that let you fix the seed (AUTOMATIC1111, ComfyUI, Diffusers), keep the seed and every setting fixed for the second image and change only one visible instruction, such as ‘close-up’ to ‘wide shot’. Comparing that pair tells you whether the model understood the change. Randomizing the seed at the same time turns the comparison into guesswork. In PhoneDiffusion each run uses a new seed, so generate a few images per prompt version and compare the sets.

What a seed can and cannot reproduce

Within the same pipeline, a fixed seed and fixed settings make iteration reproducible: the CompVis script exposes a seed option for reproducible sampling, and Diffusers documents seeded generators that return the same image each time.

Exact reproduction can still change across model files, app versions, schedulers, numerical precision, hardware, or implementations. Save the image itself alongside its settings. Treat the seed as workflow metadata, not as a permanent address for the pixels; Stable Diffusion seeds explained covers how to recreate and vary an image from one.

PhoneDiffusion availability and article scope

PhoneDiffusion provides on-device text-to-image on supported iPhone and iPad devices running iOS 17 or later, using compatible curated model packs installed through the app. It also provides separate supported editing resources for image-to-image, inpainting, 4× upscaling, and background removal. Optional cloud models (such as GPT Image, Nano Banana, Seedream, and FLUX, on paid monthly or yearly plans) also do text-to-image, but online: your prompt is sent to PhoneDiffusion’s AI provider, and negative prompts and step settings do not apply.

The exact settings depend on the installed pack and current release. PhoneDiffusion does not promise that a desktop recipe, checkpoint, scheduler name, or seed will reproduce identical pixels on iPhone.

Field notes

  • txt2img = text-to-image: a prompt guides denoising from pure noise into a new image, with no input photo.
  • img2img starts from an existing image instead; txt2img is the full-noise case.
  • Prompt, negative prompt, seed, size, steps, guidance (CFG), and sampler each have a distinct job.
  • On desktop, use each model's native size (512×512 for SD 1.5, 1024×1024 for SDXL); phone packs are often converted at a fixed size, for example Apple's iOS SDXL build at 768×768. Avoid extreme guidance values.

Try it on your phone

  1. Select one model and generate at its native size (or the pack's fixed size on a phone) with the recommended preset.
  2. Write a prompt with a specific subject, action, environment, medium, light, and framing.
  3. Generate once and record the prompt, model and preset (plus seed, size, steps, CFG and sampler in tools that show them).
  4. Change one visible phrase and compare: with a fixed seed, compare the pair; in PhoneDiffusion, which picks a new seed each run, compare a few images per version.

Sources and verification

Primary and maintainer documentation checked for this guide. Product-specific details were reviewed against the current PhoneDiffusion scope.