Skip to content

Commit

Permalink
Fix resolution issue
Browse files Browse the repository at this point in the history
  • Loading branch information
axodox committed Jul 29, 2023
1 parent cd9d587 commit 5694b21
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Unpaint/StableDiffusionModelExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,16 @@ namespace winrt::Unpaint
async_operation_source async;
operation.set_source(async);

auto targetResolution = Size::Zero;
if (rawTask.InputImage) targetResolution = rawTask.InputImage.Size();
else if (rawTask.InputCondition) targetResolution = rawTask.InputCondition.Size();
else if (rawTask.InputMask) targetResolution = rawTask.InputMask.Size();
else targetResolution = { int(rawTask.Resolution.x), int(rawTask.Resolution.y) };

auto task = rawTask;
if (task.InputImage) task.InputImage = task.InputImage.Resize(task.Resolution.x, task.Resolution.y);
if (task.InputMask) task.InputMask = task.InputMask.Resize(task.Resolution.x, task.Resolution.y);
if (task.InputCondition) task.InputCondition = task.InputCondition.Resize(task.Resolution.x, task.Resolution.y);
if (task.InputImage) task.InputImage = task.InputImage.Resize(targetResolution.Width, targetResolution.Height);
if (task.InputMask) task.InputMask = task.InputMask.Resize(targetResolution.Width, targetResolution.Height);
if (task.InputCondition) task.InputCondition = task.InputCondition.Resize(targetResolution.Width, targetResolution.Height);

try
{
Expand Down

0 comments on commit 5694b21

Please sign in to comment.