Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Scale H3 Image resolution presets

Bittia8070d3407e2
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 77b35eb..5df359b 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -11,6 +11,7 @@ Changes since 0.4.0.
## Fixes and improvements
- Updated the bundled Slopfab runtime to 0.2.0, including a higher MiniMax H3 Image canvas limit of 20 MP.
+- MiniMax H3 Image resolution presets use four times the width and height. Switching image models keeps the same preset position; sizes above 20 MP are unavailable.
- Fixed Extend rejecting editing drafts that already have a saved source image.
- YuE2 now defaults to six flow steps with DPM++ 2M. The previous Midpoint solver remains available in music's Advanced settings, and saved generator templates using the old 32-step default upgrade once to six steps.
- On first launch after updating, each recent project gets a one-time cleanup of orphaned generated media, latents and caches. Other projects receive the cleanup when first opened; files still referenced by the project are preserved.
diff --git a/src/components/workspace/ExtendSettings.tsx b/src/components/workspace/ExtendSettings.tsx
index fe7e0f1..b1e9d56 100644
--- a/src/components/workspace/ExtendSettings.tsx
+++ b/src/components/workspace/ExtendSettings.tsx
@@ -2,7 +2,7 @@ import { SliderNumberInput, GENERATION_STEPS_RANGE } from "./SliderNumberInput";
import { useMemo } from "react";
import { alignExtendBounds, compileExtendImage, initialExtendBounds, EXTEND_GRID, EXTEND_MAX_EDGE, type ExtendOptions } from "../../lib/extendImage";
import { PROJECT_RESOLUTIONS, type ProjectAsset, type ProjectConfig } from "../../lib/project";
-import { imageSettings } from "../../lib/imageSettings";
+import { imageSettings, imageResolutionScale, imageGenerationDimensions, imageGenerationSizeError } from "../../lib/imageSettings";
import { ComboBox, InfoBar, ItemHeader, PropRow } from "../ui";
import { Dismiss16, Sparkle16 } from "../ui/icons";
import { PromptTextField, type PromptReference } from "./PromptTextField";
@@ -28,7 +28,10 @@ export function ExtendSettings({ config, source, options, onChange, onResolution
<form className="image-template-settings__form" onSubmit={(event) => { event.preventDefault(); if (!busy && !disabledReason && !validation.message) onExecute(); }}>
<div className="image-inspector__fields image-template-settings__fields">
<PropRow label="Resolution" htmlFor="extend-resolution" tooltip="The box sets the aspect ratio. The selected resolution sets the pixel budget; expanding the box makes the source smaller within that output.">
- <ComboBox id="extend-resolution" aria-label="Zoom resolution" value={imageSettings(config).resolution} options={PROJECT_RESOLUTIONS.map((value) => ({ value, label: value }))}
+ <ComboBox id="extend-resolution" aria-label="Zoom resolution" value={imageSettings(config).resolution} options={PROJECT_RESOLUTIONS.map((value) => {
+ const error = imageGenerationSizeError(imageGenerationDimensions(value, imageSettings(config).aspectRatio, template.modelType), template.modelType);
+ return { value, label: `${Number.parseInt(value) * imageResolutionScale(template.modelType)}p`, disabled: Boolean(error), description: error ?? undefined };
+ })}
disabled={busy || !onResolutionChange} onChange={(value) => onResolutionChange?.(value)} />
</PropRow>
{validation.output && <p className="image-inspector__caption">Output: {validation.output.width} × {validation.output.height} px</p>}
diff --git a/src/components/workspace/ImageEditor.test.tsx b/src/components/workspace/ImageEditor.test.tsx
index 57e02c0..8037b1b 100644
--- a/src/components/workspace/ImageEditor.test.tsx
+++ b/src/components/workspace/ImageEditor.test.tsx
@@ -35,6 +35,39 @@ function setup(initial = parseProjectConfig(fixture), workItems: WorkItem[] = []
return () => latest;
}
+it("keeps the resolution preset when switching to H3 Image and back, including after reopening", () => {
+ const normal = { ...defaultGeneratorTemplate(), id: "normal", name: "Normal image model" };
+ const h3 = { ...normal, id: "h3-image", name: "MiniMax H3 Image", modelType: "h3_image", defaultSteps: 6 };
+ saveGeneratorTemplateSettings({ templates: [normal, h3], defaultTemplateId: normal.id, catalogVersion: 23 });
+ installH3TestDependencies();
+ const initial = parseProjectConfig(fixture);
+ initial.imageScene = createImageScene("A forest");
+ initial.imageSettings = { resolution: "544p", aspectRatio: "1:1" };
+ const current = setup(initial);
+ expect(screen.getByRole("combobox", { name: "Resolution" })).toHaveTextContent("544 × 544");
+ choose("Generator", "MiniMax H3 Image");
+ expect(screen.getByRole("combobox", { name: "Resolution" })).toHaveTextContent("2176 × 2176");
+ choose("Resolution", "3072 × 3072");
+ expect(current().imageSettings?.resolution).toBe("768p");
+ choose("Generator", "Normal image model");
+ expect(screen.getByRole("combobox", { name: "Resolution" })).toHaveTextContent("768 × 768");
+ choose("Generator", "MiniMax H3 Image");
+ const saved = parseProjectConfig(current());
+ cleanup();
+ const reopened = setup(saved);
+ expect(screen.getByRole("combobox", { name: "Resolution" })).toHaveTextContent("3072 × 3072");
+ fireEvent.click(screen.getByRole("combobox", { name: "Resolution" }));
+ expect(screen.getByRole("option", { name: /8192 × 8192/ })).toHaveAttribute("aria-disabled", "true");
+ fireEvent.click(screen.getByRole("combobox", { name: "Resolution" }));
+ choose("Generator", "Normal image model");
+ choose("Resolution", "2048 × 2048");
+ choose("Generator", "MiniMax H3 Image");
+ expect(screen.getByRole("combobox", { name: "Resolution" })).toHaveTextContent("8192 × 8192");
+ expect(reopened().imageSettings?.resolution).toBe("2048p");
+ expect(screen.getByRole("button", { name: "Generate" })).toBeDisabled();
+ expect(screen.getByRole("status")).toHaveTextContent("20 MP");
+});
+
it("updates a low-resolution image preview in the canvas and image card, then removes it on completion", () => {
const config = parseProjectConfig(fixture);
config.imageScene = createImageScene("A forest");
diff --git a/src/components/workspace/ImageEditor.tsx b/src/components/workspace/ImageEditor.tsx
index 85ea63d..424ffd4 100644
--- a/src/components/workspace/ImageEditor.tsx
+++ b/src/components/workspace/ImageEditor.tsx
@@ -10,8 +10,7 @@ import { Add14, Add16, Boxes16, Boxes16Filled, ChevronDown14, ChevronRight14, Co
import { invoke } from "@tauri-apps/api/core";
import { addImageNode, createImageEditScene, createImageScene, duplicateImageNode, imageDescendants, imageScenePrompt, imageLassoPath, imageLassoSchema, simplifyImageLasso, removeImageNode, resizeImageNode, type ImageBox, type ImageNode, type ImageScene, type ImageSource, type ImagePoint } from "../../lib/imageScene";
import { compileImageEdits, editGeneratedImage, imageEditDebugPrompt, imageEditOutputSize, imageEditSize, imageEditRegionSize, limitImageEditBox, limitImageEditScene } from "../../lib/imageEditing";
-import { imageSettings } from "../../lib/imageSettings";
-import { outputDimensions } from "../../lib/export";
+import { imageSettings, imageGenerationDimensions, imageGenerationSizeError } from "../../lib/imageSettings";
import { compileImagePrompt } from "../../lib/imagePrompt";
import { createEmptyImage, imageFamily, imageFamilyRoot, makeImagePrimary, removeImageAsset, restoreGeneratedImage, saveImageDraft } from "../../lib/imageHistory";
import { isTauri } from "../../lib/persistence";
@@ -100,16 +99,24 @@ export function ImageEditor({ config, folderPath, onChange: changeConfig, onGene
const usedGenerator = imageTemplates.find((candidate) => candidate.id === generatedImage?.imageGeneration?.generatorTemplateId);
const model = generatorModel(template?.modelType);
const cfgDefault = template ? imageCfgScale(template.modelType, undefined, template.kreaVariant) ?? 0 : 0;
+ const generationSize = imageGenerationDimensions(settings.resolution, settings.aspectRatio, template?.modelType);
+ const resolutionOptions = [...new Set([...PROJECT_RESOLUTIONS, settings.resolution])].map((resolution) => {
+ const size = imageGenerationDimensions(resolution, settings.aspectRatio, template?.modelType);
+ const error = imageGenerationSizeError(size, template?.modelType);
+ return { value: resolution, label: `${size.width} × ${size.height}`, disabled: Boolean(error), description: error ?? undefined };
+ });
const editPlan = useMemo(() => {
if (!imageRoot) return null;
try { return { ...compileImageEdits(config, { modelType: template?.modelType }), error: null }; }
catch (reason) { return { edits: [], error: String(reason instanceof Error ? reason.message : reason) }; }
}, [config, imageRoot, template?.modelType]);
const inputBlocked = useMemo(() => {
- if (imageRoot || !model.requiresImageInput) return null;
+ if (imageRoot) return null;
+ const sizeError = imageGenerationSizeError(generationSize, template?.modelType);
+ if (sizeError || !model.requiresImageInput) return sizeError;
try { compileImagePrompt(config, { modelType: template?.modelType }); return null; }
catch (reason) { return reason instanceof Error ? reason.message : String(reason); }
- }, [config, imageRoot, model.requiresImageInput, template?.modelType]);
+ }, [config, imageRoot, model.requiresImageInput, template?.modelType, generationSize.width, generationSize.height]);
const outpaintingBlocked = !templateSupportsOutpainting(template) ? `${template.name} does not support Zoom.` : null;
const effectsBlocked = activeGenerationEffects(scene.generationEffects) && !model.generationEffects ? "This model does not support generation effects. Bypass or remove the effects, or choose another generator." : null;
const editingBlocked = !templateSupportsEditing(template) ? `${template.name} does not support image editing. Choose an editing generator.` : null;
@@ -204,7 +211,7 @@ export function ImageEditor({ config, folderPath, onChange: changeConfig, onGene
const templateSource = runningTemplate && config.assets.find((asset) => asset.id === runningTemplate.sourceId);
let extendSize: { width: number; height: number } | null = null;
if (extendMode && extendOptions && output?.width && output.height) {
- try { extendSize = extendOutputDimensions(config, extendOptions.bounds); }
+ try { extendSize = extendOutputDimensions(config, extendOptions.bounds, template?.modelType); }
catch { /* Invalid bounds are explained in Zoom settings. */ }
}
const images = config.assets.filter((asset) => asset.kind === "image");
@@ -215,7 +222,7 @@ export function ImageEditor({ config, folderPath, onChange: changeConfig, onGene
const showResult = Boolean(output && !output.imageDraft && output.imageGeneration && (output.relativePath || output.sourcePath));
const { width, height } = showResult && output?.width && output.height ? { width: output.width, height: output.height } : imageRoot && scene.sourceImage ? scene.sourceImage : output?.width && output?.height
? { width: output.width, height: output.height }
- : outputDimensions(settings.resolution, settings.aspectRatio);
+ : generationSize;
useEffect(() => subscribeGeneratorTemplates(() => setTemplates(loadGeneratorTemplateSettings())), []);
const commit = (next: ImageScene) => {
@@ -854,7 +861,7 @@ export function ImageEditor({ config, folderPath, onChange: changeConfig, onGene
onUse={usedGenerator && templateUsable(usedGenerator) ? () => saveActiveGeneratorId("image", usedGenerator.id) : undefined} />
</>}
{!imageRoot && <PropRow label="Aspect ratio" htmlFor={rootField("ratio")}><ComboBox id={rootField("ratio")} aria-label="Aspect ratio" value={settings.aspectRatio} options={["16:9", "9:16", "1:1", "4:5"].map((ratio) => ({ value: ratio, label: ratio }))} onChange={(value) => { const aspectRatio = value as ProjectConfig["settings"]["aspectRatio"]; onChange((current) => ({ ...current, imageSettings: { ...imageSettings(current), aspectRatio } })); }} /></PropRow>}
- {imageRoot ? editSize && <PropRow label="Resolution" htmlFor={rootField("resolution")}><ComboBox id={rootField("resolution")} aria-label="Resolution" value={sizeValue(editSize)} options={editSizes.map((size) => ({ value: sizeValue(size), label: `${size.width} × ${size.height}` }))} onChange={(value) => { const size = editSizes.find((size) => sizeValue(size) === value); if (size) commit({ ...scene, outputSize: size }); }} /></PropRow> : <PropRow label="Resolution" htmlFor={rootField("resolution")}><ComboBox id={rootField("resolution")} aria-label="Resolution" value={settings.resolution} options={[...new Set([...PROJECT_RESOLUTIONS, settings.resolution])].map((resolution) => { const size = outputDimensions(resolution, settings.aspectRatio); return { value: resolution, label: `${size.width} × ${size.height}` }; })} onChange={(value) => { const resolution = value as ProjectConfig["settings"]["resolution"]; onChange((current) => ({ ...current, imageSettings: { ...imageSettings(current), resolution } })); }} /></PropRow>}
+ {imageRoot ? editSize && <PropRow label="Resolution" htmlFor={rootField("resolution")}><ComboBox id={rootField("resolution")} aria-label="Resolution" value={sizeValue(editSize)} options={editSizes.map((size) => ({ value: sizeValue(size), label: `${size.width} × ${size.height}` }))} onChange={(value) => { const size = editSizes.find((size) => sizeValue(size) === value); if (size) commit({ ...scene, outputSize: size }); }} /></PropRow> : <PropRow label="Resolution" htmlFor={rootField("resolution")}><ComboBox id={rootField("resolution")} aria-label="Resolution" value={settings.resolution} options={resolutionOptions} onChange={(value) => { const resolution = value as ProjectConfig["settings"]["resolution"]; onChange((current) => ({ ...current, imageSettings: { ...imageSettings(current), resolution } })); }} /></PropRow>}
</PropSection>
{imageRoot && imageEditRegionSize(scene) && <PropRow label="Saved image" tooltip="Local boxes and lassos are limited to the selected resolution. Their edits are merged into the original image.">
<span>{scene.sourceImage!.width} × {scene.sourceImage!.height}</span>
diff --git a/src/lib/extendImage.ts b/src/lib/extendImage.ts
index e09c31b..238bfaa 100644
--- a/src/lib/extendImage.ts
+++ b/src/lib/extendImage.ts
@@ -1,6 +1,6 @@
import { FIBO_MODEL_TYPE, MINIMAX_H3_MODEL_TYPE } from "./settings";
import type { ImageEditStep } from "./imageEditing";
-import { imageSettings } from "./imageSettings";
+import { imageSettings, imageGenerationDimensions, imageGenerationSizeError, H3_IMAGE_MAX_PIXELS } from "./imageSettings";
import { createImageEditScene } from "./imageScene";
import { compileImagePrompt } from "./imagePrompt";
import { outputDimensions } from "./export";
@@ -42,22 +42,25 @@ export function initialExtendBounds(width: number, height: number): ExtendBounds
return { ...box, x: Math.round((source.width - box.width) / 2), y: Math.round((source.height - box.height) / 2) };
}
-export function extendOutputDimensions(config: ProjectConfig, bounds: ExtendBounds) {
- const selected = outputDimensions(imageSettings(config).resolution, imageSettings(config).aspectRatio);
- const pixelBudget = Math.min(selected.width * selected.height, EXTEND_MAX_PIXELS);
- const scale = Math.min(Math.sqrt(pixelBudget / (bounds.width * bounds.height)), EXTEND_MAX_EDGE / bounds.width, EXTEND_MAX_EDGE / bounds.height);
+export function extendOutputDimensions(config: ProjectConfig, bounds: ExtendBounds, modelType?: string) {
+ const selected = imageGenerationDimensions(imageSettings(config).resolution, imageSettings(config).aspectRatio, modelType);
+ const error = imageGenerationSizeError(selected, modelType);
+ if (error) throw new Error(error);
+ const pixelBudget = Math.min(selected.width * selected.height, modelType === "h3_image" ? H3_IMAGE_MAX_PIXELS : EXTEND_MAX_PIXELS);
+ const maxEdge = modelType === "h3_image" ? 8192 : EXTEND_MAX_EDGE;
+ const scale = Math.min(Math.sqrt(pixelBudget / (bounds.width * bounds.height)), maxEdge / bounds.width, maxEdge / bounds.height);
const width = Math.floor(bounds.width * scale / EXTEND_GRID) * EXTEND_GRID;
const height = Math.floor(bounds.height * scale / EXTEND_GRID) * EXTEND_GRID;
if (width < EXTEND_GRID || height < EXTEND_GRID) throw new Error("The Zoom box is too narrow for a 32-pixel generation grid at this resolution.");
return { width, height };
}
-export function extendLayout(config: ProjectConfig, source: { width: number; height: number }, bounds: ExtendBounds) {
+export function extendLayout(config: ProjectConfig, source: { width: number; height: number }, bounds: ExtendBounds, modelType?: string) {
const workspace = extendSourceDimensions(source.width, source.height);
const selection = extendRegions(workspace, bounds);
if (bounds.width % EXTEND_GRID || bounds.height % EXTEND_GRID || bounds.width > EXTEND_MAX_EDGE || bounds.height > EXTEND_MAX_EDGE
|| bounds.width * bounds.height > EXTEND_MAX_PIXELS) throw new Error("Use box dimensions in multiples of 32 within the maximum generation resolution.");
- const output = extendOutputDimensions(config, bounds);
+ const output = extendOutputDimensions(config, bounds, modelType);
if (!selection.regions.length) {
const frame = { x: 0, y: 0, ...output };
return { mode: "regenerate" as const, output, source: output, bounds: frame, preserved: frame, regions: [] };
@@ -116,7 +119,7 @@ function extendBlendOverlap(context: ExtendBounds, output: { width: number; heig
export function compileExtendImage(config: ProjectConfig, source: ProjectAsset, sourceRelativePath: string, options: ExtendOptions, modelType = MINIMAX_H3_MODEL_TYPE) {
if (!source.width || !source.height) throw new Error("Wait for the source image dimensions to load.");
- const layout = extendLayout(config, { width: source.width, height: source.height }, options.bounds);
+ const layout = extendLayout(config, { width: source.width, height: source.height }, options.bounds, modelType);
const { preserved, output } = layout;
const regenerate = layout.mode === "regenerate";
const fibo = modelType === FIBO_MODEL_TYPE;
diff --git a/src/lib/h3Image.test.ts b/src/lib/h3Image.test.ts
index d71e73a..9d4cd7e 100644
--- a/src/lib/h3Image.test.ts
+++ b/src/lib/h3Image.test.ts
@@ -10,6 +10,14 @@ import { createProjectConfig } from "./project";
beforeEach(() => localStorage.clear());
const project = () => createProjectConfig({ name: "Image", generationType: "image", prompt: "A blue teapot", aspectRatio: "1:1", resolution: "416p", targetDurationSeconds: 15 });
+it("uses the same preset at four times each dimension for H3 Image Zoom", () => {
+ const config = project();
+ const source = { id: "source", name: "Source", kind: "image" as const, mimeType: "image/png", width: 128, height: 128, createdAt: config.createdAt };
+ const options = { bounds: { x: -32, y: -32, width: 192, height: 192 }, prompt: "Forest", steps: 6, seed: 0 };
+ expect(compileExtendImage(config, source, "canvas.png", options, "minimax-h3").layout.output).toEqual({ width: 416, height: 416 });
+ expect(compileExtendImage(config, source, "canvas.png", options, "h3_image").layout.output).toEqual({ width: 1664, height: 1664 });
+});
+
it("adds MiniMax H3 Image once without changing selected or custom generators, and respects removal", () => {
const custom = { ...minimaxImageTemplate(), id: "custom", name: "My images", paths: { ...minimaxImageTemplate().paths, transformer: "D:/model.safetensors" } };
saveGeneratorTemplateSettings({ templates: [custom], defaultTemplateId: custom.id, catalogVersion: 22 });
diff --git a/src/lib/imageSettings.ts b/src/lib/imageSettings.ts
index f4d1fba..4156cc3 100644
--- a/src/lib/imageSettings.ts
+++ b/src/lib/imageSettings.ts
@@ -1,4 +1,24 @@
-import type { ProjectConfig } from "./project";
+import type { AspectRatio, ProjectConfig, Resolution } from "./project";
+import { outputDimensions } from "./export";
+
+export const H3_IMAGE_MAX_PIXELS = 20 * 1024 * 1024;
+
+/** Keep the stored preset as a stable index across image models. */
+export function imageResolutionScale(modelType?: string) {
+ return modelType === "h3_image" ? 4 : 1;
+}
+
+export function imageGenerationDimensions(resolution: Resolution, aspectRatio: AspectRatio, modelType?: string) {
+ const size = outputDimensions(resolution, aspectRatio);
+ const scale = imageResolutionScale(modelType);
+ return { width: size.width * scale, height: size.height * scale };
+}
+
+export function imageGenerationSizeError(size: { width: number; height: number }, modelType?: string) {
+ return modelType === "h3_image" && size.width * size.height > H3_IMAGE_MAX_PIXELS
+ ? "MiniMax H3 Image supports up to 20 MP. Choose a smaller resolution."
+ : null;
+}
/** Legacy images inherit project defaults until their own settings are saved. */
export function imageSettings(config: ProjectConfig): NonNullable<ProjectConfig["imageSettings"]> {
diff --git a/src/lib/workQueue.test.ts b/src/lib/workQueue.test.ts
index 81e86ef..f69c7e3 100644
--- a/src/lib/workQueue.test.ts
+++ b/src/lib/workQueue.test.ts
@@ -1045,6 +1045,22 @@ describe("agent scene generation", () => {
describe("image generation work", () => {
const template: GeneratorTemplate = { id: "image-test", name: "MiniMax H3", modelType: "minimax-h3", defaultSteps: 20, attention: "sage2", paths: { ...EMPTY_ENGINE_SETTINGS, transformer: "C:/h3.safetensors" } };
const imageProject = (): ProjectRecord => ({ folderPath: "C:/Image", config: createProjectConfig({ name: "Poster", prompt: "An ocean poster", generationType: "image", aspectRatio: "1:1", resolution: "768p", targetDurationSeconds: 60 }) });
+ it("submits H3 Image at four times each dimension and rejects oversized presets before creating a draft", async () => {
+ const { queue } = setup();
+ const session = queue.project(imageProject());
+ const h3 = { ...template, modelType: "h3_image" };
+ const id = queue.enqueueImage(session, h3);
+ await waitFor(() => expect(enqueueSlopfabGeneration).toHaveBeenCalledOnce());
+ expect(queue.getSnapshot().find(item => item.id === id)?.settings).toMatchObject({ canvasWidth: 3072, canvasHeight: 3072 });
+ expect(vi.mocked(enqueueSlopfabGeneration).mock.calls[0][0]).toMatchObject({ canvasWidth: 3072, canvasHeight: 3072 });
+ const oversized = imageProject();
+ oversized.folderPath = "C:/Oversized";
+ oversized.config.imageSettings = { resolution: "1344p", aspectRatio: "1:1" };
+ const other = queue.project(oversized);
+ const before = other.getSnapshot().config;
+ expect(() => queue.enqueueImage(other, h3)).toThrow("20 MP");
+ expect(other.getSnapshot().config).toBe(before);
+ });
it.each(["minimax-h3", "moss-image"] as const)("accepts single-frame image previews only for MiniMax (%s)", async modelType => {
const { queue } = setup();
const session = queue.project(imageProject());
diff --git a/src/lib/workQueue.ts b/src/lib/workQueue.ts
index 0f7e01b..0fa1faf 100644
--- a/src/lib/workQueue.ts
+++ b/src/lib/workQueue.ts
@@ -6,7 +6,7 @@ import { albumCoverGenerator } from "./referenceIconSettings";
import { templateSupportsMusic } from "./settings";
import { imageCfgScale } from "./generatorModels";
import { activeGenerationEffects } from "./generationEffects";
-import { imageSettings } from "./imageSettings";
+import { imageSettings, imageGenerationDimensions, imageGenerationSizeError } from "./imageSettings";
import { listen } from "@tauri-apps/api/event";
import { invoke } from "@tauri-apps/api/core";
import { createImageEditScene, createImageScene, imageScenePrompt } from "./imageScene";
@@ -16,7 +16,6 @@ import { compileExtendImage, type ExtendOptions } from "./extendImage";
import { CHARACTER_SHEET_ORDER, CHARACTER_SHEET_VIEWS, characterSheetDimensions, characterSheetViewIndices, characterSheetViews, compileCharacterSheet, type CharacterSheetOptions } from "./characterSheet";
import { completeImageDraft, createTemplateImageDraft, imageFamilyRoot, imageGenerationSnapshot, saveImageDraft } from "./imageHistory";
import type { ImageGenerationSnapshot, ProjectAsset } from "./project";
-import { outputDimensions } from "./export";
import { projectItemPath, referenceDefinition, referenceImages, referenceRefmodInputs } from "./project";
import { generationSigmaShiftsWithLoras, engineProviderSetting, generatorModel, templateSupportsEditing, templateSupportsOutpainting, templateSupportsImages, templateSupportsVideo, defaultGeneratorTemplate, loadGeneratorTemplateSettings, type GeneratorTemplate } from "./settings";
import { describeDiagnosticError, writeDiagnostic } from "./diagnostics";
@@ -405,7 +404,9 @@ export class WorkQueue {
const projectKey = projectQueueKey(session.record);
if (this.items.some((item) => item.projectKey === projectKey && item.kind === "image" && (item.imageDraftId ?? item.imageAssetId) === scene.outputAssetId && isWorkActive(item))) return;
const { prompt, references } = edit ? edit.edits[0] : compileImagePrompt(current, { modelType: template.modelType });
- const { width, height } = edit ? imageEditCanvasSize(scene) : outputDimensions(imageSettings(current).resolution, imageSettings(current).aspectRatio);
+ const { width, height } = edit ? imageEditCanvasSize(scene) : imageGenerationDimensions(imageSettings(current).resolution, imageSettings(current).aspectRatio, template.modelType);
+ const sizeError = !edit && imageGenerationSizeError({ width, height }, template.modelType);
+ if (sizeError) throw new Error(sizeError);
const id = `image-${crypto.randomUUID()}`;
const negativePrompt = generatorModel(template.modelType).negativePrompt ? scene.negativePrompts?.[template.modelType] : undefined;
const guidanceScale = imageCfgScale(template.modelType, scene.cfgScales, template.kreaVariant);