Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:AUTOMATIC1111 Stable diffusion webui Extra Options Section

From Leeroopedia


Knowledge Sources
Domains UI_Extension, Settings, Gradio
Last Updated 2025-05-15 00:00 GMT

Overview

A built-in extension script that allows users to surface selected settings directly in the txt2img and img2img generation interfaces.

Description

ExtraOptionsSection is a Script subclass that dynamically generates Gradio UI components for user-selected settings and places them directly into the generation tab interfaces. Users can choose which settings to expose via the "Settings for txt2img" and "Settings for img2img" configuration options. The script reads the configured list of extra options, creates the appropriate Gradio components using ui_settings.create_setting_component, and arranges them in a configurable grid layout (with adjustable column count). It supports optional accordion grouping and integrates with the infotext system so that setting values are recorded in generation metadata. During processing, the before_process method applies these settings as overrides to the generation parameters. The module also registers its own settings section ("Settings in UI") to configure which options appear and how they are displayed.

Usage

This extension is always visible in the generation tabs. Users configure which settings to expose through Settings > "Settings in UI". Once configured, the selected settings appear directly in the txt2img or img2img interface, allowing quick adjustment without navigating to the full settings page.

Code Reference

Source Location

Signature

class ExtraOptionsSection(scripts.Script):
    section = "extra_options"

    def __init__(self):
    def title(self):
    def show(self, is_img2img):
    def ui(self, is_img2img):
    def before_process(self, p, *args):

Import

# Loaded automatically as a built-in extension script
# No direct import needed; registered via scripts.Script discovery

I/O Contract

Inputs

Name Type Required Description
is_img2img bool Yes Whether the script is running in img2img mode (vs txt2img)
p processing.StableDiffusionProcessing Yes The processing object for the current generation
*args varies Yes Values from the dynamically created UI components, matching self.setting_names

Outputs

Name Type Description
comps list List of Gradio components created for the extra options UI

Usage Examples

# Configuration in settings (no code needed by end users):
# 1. Go to Settings > "Settings in UI"
# 2. Add setting names to "Settings for txt2img" or "Settings for img2img"
#    e.g., ["CLIP_stop_at_last_layers", "sd_model_checkpoint"]
# 3. Adjust "Number of columns for added settings" as desired
# 4. Reload UI

# The selected settings will then appear directly in the generation tab.
# Values set there override the global settings for that generation run.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment