fix: preserve reference image dimensions in server requests - #2007
mikemikimike wants to merge 4 commits into
Conversation
leejet
left a comment
There was a problem hiding this comment.
Please do not commit any test-related files.
|
@leejet The current head is |
| static_cast<int>(bytes.size()), | ||
| img_w, img_h, | ||
| width, height, 3); | ||
| 0, 0, 3); |
There was a problem hiding this comment.
The first reference image is also copied into init_image below. With this change, that copy retains the original dimensions and is later stretched to the output size by sd_image_to_tensor(), while the mask still goes through center-cropping and resizing during decoding.
When the uploaded image and mask have a different aspect ratio from the requested output, they therefore become misaligned, causing inpainting to affect the wrong region. I reproduced this with a 128×64 image/mask pair and a 64×64 output: they align before this change but not afterward.
Please keep the reference at its original size while separately applying the existing output-size crop/resize preprocessing to init_image, so it stays aligned with the mask.
a4356f5 to
c0d53d9
Compare
Signed-off-by: mikemikimike <13286568797@163.com>
c0d53d9 to
1aabbdc
Compare
Summary
ref_images, sdapiextra_images, and OpenAI edit uploads during decoding.Issue: #2004
Fixes #2004
Testing
cmake -S . -B build -DSD_BUILD_EXAMPLES=ON -DSD_SERVER_BUILD_FRONTEND=OFF -DSD_WEBP=OFF -DSD_WEBM=OFF -DCMAKE_BUILD_TYPE=Releasecmake --build build --parallel 4sd-cli --helpsd-server --help