feat(server): add image upscale endpoints#3
Open
mihard wants to merge 1 commit into
Open
Conversation
mihard
force-pushed
the
feat/server-upscale-api
branch
from
May 31, 2026 21:33
587d196 to
06070cb
Compare
mihard
force-pushed
the
feat/server-upscale-api
branch
from
June 5, 2026 15:50
06070cb to
c93ae95
Compare
Add standalone image upscaling to both server API surfaces:
- POST /sdapi/v1/extra-single-image (synchronous, A1111-compatible).
Accepts image + upscaler_1/upscaler_2 + upscaling_resize/target dims
and returns {"image": "<base64-png>", "html_info": ""}.
- POST /sdcpp/v1/upscale (async job, polled via /sdcpp/v1/jobs/{id}).
Shared perform_upscale() supports built-in resamplers (None passthrough,
Lanczos via CatmullRom, Nearest via Box through the new resize_sd_image()
helper in media_io), model-backed ESRGAN upscalers resolved from the hires
upscalers dir, optional two-upscaler blending, and exact target-size
resizing when a model's native scale differs from the requested size.
The blend path only runs when both upscaler outputs share identical
dimensions to avoid reading past the smaller buffer.
mihard
force-pushed
the
feat/server-upscale-api
branch
from
June 5, 2026 15:52
c93ae95 to
7f49366
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Adds standalone image upscaling to the server, exposed on both API surfaces:
POST /sdapi/v1/extra-single-image— synchronous, A1111-compatible. Accepts abase64 image plus
upscaler_1,upscaler_2,upscaling_resize/ target dims andreturns
{"image": "<base64-png>", "html_info": ""}.POST /sdcpp/v1/upscale— async job variant, polled via the existingGET /sdcpp/v1/jobs/{id}endpoint.The shared
perform_upscale()function handles:None(passthrough copy),Lanczos(CatmullRom filter),Nearest(Box filter) via a newresize_sd_image()helper inmedia_io.hires_upscalers_dir.upscaler_2_visibility), guarded so it onlyruns when both outputs share identical dimensions.
A new
AsyncJobKind::Upscalevariant andUpscaleJobRequeststruct extend theexisting async job system without touching unrelated code paths.
Verification
Build with server examples enabled:
Smoke test — synchronous Lanczos upscale (2×):
Async upscale:
Checklist