Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: show the Custom size fields under Output size in unified Edit (#11690)

oobabooga0cf8bbc02de6
diff --git a/studio/frontend/src/features/images/images-page.tsx b/studio/frontend/src/features/images/images-page.tsx
index 81bd19668ba..31ba229a702 100644
--- a/studio/frontend/src/features/images/images-page.tsx
+++ b/studio/frontend/src/features/images/images-page.tsx
@@ -3699,6 +3699,128 @@ export function ImagesPage({
</Field>
) : null;
+ // Aspect ratio, Resolution and 2K presets. Unified Edit shows them under Output size when Custom is
+ // picked, next to the choice that reveals them; every other workflow keeps them in place.
+ const sizeControls = (
+ <>
+ <Field
+ label="Aspect ratio"
+ hint="Pick a ratio to lock the proportions, then set the size below. Flip swaps width and height."
+ >
+ <div className="flex items-center gap-2">
+ <Select
+ value={aspect}
+ onValueChange={changeAspect}
+ open={active && aspectOpen}
+ onOpenChange={(o) => setAspectOpen(active && o)}
+ >
+ <SelectTrigger className="flex-1">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {ASPECT_OPTIONS.map((key) => (
+ <SelectItem key={key} value={key}>
+ {key === "custom"
+ ? "Custom"
+ : `${ASPECT_LABELS[key]} (${key})`}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <Tooltip>
+ <TooltipTrigger asChild={true}>
+ <Button
+ type="button"
+ variant="secondary"
+ size="icon"
+ aria-label="Flip width and height"
+ onClick={flipDimensions}
+ >
+ {/* Arrows turn with the orientation, showing which way it flips. */}
+ <HugeiconsIcon
+ icon={ArrowLeftRightIcon}
+ className={cn(
+ "size-4 transition-transform duration-200",
+ portrait && "rotate-90",
+ )}
+ />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ {portrait ? "Switch to landscape" : "Switch to portrait"}
+ </TooltipContent>
+ </Tooltip>
+ </div>
+ </Field>
+ <Field
+ label="Resolution"
+ hint={
+ // Image-conditioned workflows size from the source, so "this is the output size" is wrong
+ // there: Transform caps the source by this box, the rest ignore it.
+ workflow === "transform"
+ ? "Caps the output size. The source image is scaled down to fit inside this box, keeping its aspect ratio, so the result may be smaller than the values shown."
+ : workflow === "inpaint" ||
+ workflow === "extend" ||
+ workflow === "upscale" ||
+ (workflow === "edit" && !unifiedEdit)
+ ? "Not used by this workflow: the output size comes from the source image. Upload a smaller image to generate at a smaller size."
+ : `Width and height in pixels. Sizes run from ${MIN_DIM} to ${sizeLimits.maxSide} in steps of ${sizeLimits.multiple}${sizeLimits.maxPixels < sizeLimits.maxSide * sizeLimits.maxSide ? `, up to ${(sizeLimits.maxPixels / 1e6).toFixed(1)} megapixels` : ""}. Most models are trained around 1 megapixel, so much larger sizes can look worse.`
+ }
+ >
+ <div className="flex items-center gap-2">
+ <DimensionSelect
+ icon={ArrowLeftRightIcon}
+ label="Width"
+ value={width}
+ open={active && widthOpen}
+ onOpenChange={(o) => setWidthOpen(active && o)}
+ onChange={changeWidth}
+ limits={sizeLimits}
+ />
+ <DimensionSelect
+ icon={ArrowUpDownIcon}
+ label="Height"
+ value={height}
+ open={active && heightOpen}
+ onOpenChange={(o) => setHeightOpen(active && o)}
+ onChange={changeHeight}
+ limits={sizeLimits}
+ />
+ </div>
+ </Field>
+ {showOfficialPresets && (
+ <Field
+ label="2K presets"
+ hint="The model's native 2K sizes. They take several times the memory and time of a 1 megapixel image."
+ >
+ <Select
+ value=""
+ onValueChange={(v) => {
+ const preset = officialPresets.find((p) => `${p.width}x${p.height}` === v);
+ if (!preset) return;
+ setWidth(preset.width);
+ setHeight(preset.height);
+ const m = matchAspect(preset.width, preset.height);
+ setAspect(m.key);
+ setPortrait(m.portrait);
+ }}
+ >
+ <SelectTrigger aria-label="2K presets">
+ <SelectValue placeholder="Choose a 2K size" />
+ </SelectTrigger>
+ <SelectContent>
+ {officialPresets.map((p) => (
+ <SelectItem key={`${p.width}x${p.height}`} value={`${p.width}x${p.height}`}>
+ {`${p.label} (${p.width} × ${p.height})`}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </Field>
+ )}
+ </>
+ );
+
const handleGenerate = useCallback(async () => {
if (!prompt.trim()) {
toast.error("Prompt is empty");
@@ -4838,6 +4960,7 @@ export function ImagesPage({
: `${editSize.width} × ${editSize.height}`}
</p>
</Field>
+ {editSizing === "custom" && sizeControls}
{referenceDetailControl}
{engineNotes}
{unifiedEdit && (
@@ -5007,125 +5130,7 @@ export function ImagesPage({
</div>
</Field>
)}
- {!(unifiedEditActive && editSizing === "source") && (
- <>
- <Field
- label="Aspect ratio"
- hint="Pick a ratio to lock the proportions, then set the size below. Flip swaps width and height."
- >
- <div className="flex items-center gap-2">
- <Select
- value={aspect}
- onValueChange={changeAspect}
- open={active && aspectOpen}
- onOpenChange={(o) => setAspectOpen(active && o)}
- >
- <SelectTrigger className="flex-1">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {ASPECT_OPTIONS.map((key) => (
- <SelectItem key={key} value={key}>
- {key === "custom"
- ? "Custom"
- : `${ASPECT_LABELS[key]} (${key})`}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <Tooltip>
- <TooltipTrigger asChild={true}>
- <Button
- type="button"
- variant="secondary"
- size="icon"
- aria-label="Flip width and height"
- onClick={flipDimensions}
- >
- {/* Arrows turn with the orientation, showing which way it flips. */}
- <HugeiconsIcon
- icon={ArrowLeftRightIcon}
- className={cn(
- "size-4 transition-transform duration-200",
- portrait && "rotate-90",
- )}
- />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- {portrait ? "Switch to landscape" : "Switch to portrait"}
- </TooltipContent>
- </Tooltip>
- </div>
- </Field>
- <Field
- label="Resolution"
- hint={
- // Image-conditioned workflows size from the source, so "this is the output size" is wrong
- // there: Transform caps the source by this box, the rest ignore it.
- workflow === "transform"
- ? "Caps the output size. The source image is scaled down to fit inside this box, keeping its aspect ratio, so the result may be smaller than the values shown."
- : workflow === "inpaint" ||
- workflow === "extend" ||
- workflow === "upscale" ||
- (workflow === "edit" && !unifiedEdit)
- ? "Not used by this workflow: the output size comes from the source image. Upload a smaller image to generate at a smaller size."
- : `Width and height in pixels. Sizes run from ${MIN_DIM} to ${sizeLimits.maxSide} in steps of ${sizeLimits.multiple}${sizeLimits.maxPixels < sizeLimits.maxSide * sizeLimits.maxSide ? `, up to ${(sizeLimits.maxPixels / 1e6).toFixed(1)} megapixels` : ""}. Most models are trained around 1 megapixel, so much larger sizes can look worse.`
- }
- >
- <div className="flex items-center gap-2">
- <DimensionSelect
- icon={ArrowLeftRightIcon}
- label="Width"
- value={width}
- open={active && widthOpen}
- onOpenChange={(o) => setWidthOpen(active && o)}
- onChange={changeWidth}
- limits={sizeLimits}
- />
- <DimensionSelect
- icon={ArrowUpDownIcon}
- label="Height"
- value={height}
- open={active && heightOpen}
- onOpenChange={(o) => setHeightOpen(active && o)}
- onChange={changeHeight}
- limits={sizeLimits}
- />
- </div>
- </Field>
- {showOfficialPresets && (
- <Field
- label="2K presets"
- hint="The model's native 2K sizes. They take several times the memory and time of a 1 megapixel image."
- >
- <Select
- value=""
- onValueChange={(v) => {
- const preset = officialPresets.find((p) => `${p.width}x${p.height}` === v);
- if (!preset) return;
- setWidth(preset.width);
- setHeight(preset.height);
- const m = matchAspect(preset.width, preset.height);
- setAspect(m.key);
- setPortrait(m.portrait);
- }}
- >
- <SelectTrigger aria-label="2K presets">
- <SelectValue placeholder="Choose a 2K size" />
- </SelectTrigger>
- <SelectContent>
- {officialPresets.map((p) => (
- <SelectItem key={`${p.width}x${p.height}`} value={`${p.width}x${p.height}`}>
- {`${p.label} (${p.width} × ${p.height})`}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </Field>
- )}
- </>
- )}
+ {!unifiedEditActive && sizeControls}
{/* First of the one-line sliders, so it takes a bigger break than the gap gives. */}
<div className="pt-2">