mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3726] Feature Request: Dynamic NovelAI image resolution based on character count #2010
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#2010
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jswen4-tech on GitHub (Jul 16, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3726
Originally assigned to: @SpicyMarinara on GitHub.
Feature Request: Dynamic NovelAI image resolution based on character count
Summary
Automatically choose the NovelAI image resolution (portrait / square / landscape) based on how many characters the illustrator prompt depicts, instead of always using one fixed size from settings.
Problem
Marinara currently sends a single fixed resolution (from the user's image settings) for every NovelAI generation. But the ideal aspect ratio depends heavily on how many characters are in the scene:
With one fixed size, you're always wrong for two of the three cases. A solo portrait beat generated at landscape puts the character small in a wide empty frame; a three-character scene at portrait crams everyone together and encourages the model to merge or drop figures.
This matters most for face quality: at a fixed landscape size, a solo character occupies a small fraction of the frame, so the face gets very few pixels and renders poorly. Choosing portrait for solo shots meaningfully increases face pixel count with no extra cost.
Proposed behavior
Derive the subject count from the illustrator prompt and pick a matching size:
All three are within NovelAI's Opus-free pixel budget (<= 1024x1024 equivalent), so this costs no additional Anlas.
Detection: the count can be read directly from the prompt that the illustrator agent already produces:
1girl,2girls, 1boy,3boys,1other). These follow the standard NovelAI/booru convention and are summed across matches.base | char1 | char2 | ..., sosegments - 1is the character count.Working implementation
I have this running locally against
packages/server/src/services/image/image-generation.tsand it's been stable in daily use. The change is contained:detectNovelAiSubjectCount(prompt)helper (regex over the base fragment, with the pipe-count fallback).novelAiSizeForSubjectCount(count)mapper.resolveNovelAiSize(request, prompt)gains the prompt parameter and prefers the dynamic size when a count is detectable, falling back torequest.width/heightotherwise.Existing pixel-clamping logic is unchanged and still applies afterward. I'm happy to open a PR if there's interest.
Open questions / design notes
NOVELAI_DYNAMIC_SIZE=off) so it can be disabled. A proper UI toggle would probably be better.request.width/heightfrom user settings, so treating those as an "explicit override" would permanently disable dynamic sizing. My implementation lets the prompt-derived size win when a count is detected, with request dims as the fallback. That precedence is worth a design decision.@SpicyMarinara commented on GitHub (Jul 17, 2026):
Resolved by #3732, now merged into staging.