Add "Scale To Side Length" Resolution Mode to Image Batch Tool#1359
Add "Scale To Side Length" Resolution Mode to Image Batch Tool#1359GlenCarpenter wants to merge 4 commits intomcmonkeyprojects:masterfrom
Conversation
|
I feel like I should explain the reasoning why this is desired - For most image edit models (like Klein or Qwen Edit), you will get much better results if the input image matches the output resolution. So when using this with the 'Use as image prompt' option, this will set the image prompt to the same size as the output. |
|
Converting to draft as I see there was actually some additional functionality requested:
So I am thinking we can have two sliders:
This would then resize the inputs and then set the output side length accordingly. |
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
| await socket.SendAndReportError($"ImageBatchRun request from {session.User.UserID}, for folder '{input_folder}'", "Image batch needs to supply the images to at least one parameter.", API.WebsocketTimeout); | ||
| return null; | ||
| } | ||
| // In case someone tries to leverage the websocket API directly, not possible from UI |
There was a problem hiding this comment.
this comment shouldn't be here
| } | ||
| Image image = new(File.ReadAllBytes(file), MediaType.GetByExtension(file.AfterLast('.'))); | ||
| ISImage imgData = image.ToIS; | ||
| // Check EXIF to make sure we have the correct orientation |
There was a problem hiding this comment.
again, comment should be here
| Image image = new(File.ReadAllBytes(file), MediaType.GetByExtension(file.AfterLast('.'))); | ||
| ISImage imgData = image.ToIS; | ||
| // Check EXIF to make sure we have the correct orientation | ||
| if (imgData.Metadata?.ExifProfile?.TryGetValue(ExifTag.Orientation, out IExifValue<ushort> orientationValue) ?? false) |
There was a problem hiding this comment.
This seems out of place to be in this PR
| (int scaledInputWidth, int scaledInputHeight) = Utilities.ResToModelFit(imgData.Width, imgData.Height, inputSideLength * inputSideLength, 16); | ||
| image = (Image)((ImageFile)image).Resize(scaledInputWidth, scaledInputHeight); | ||
| imgData = image.ToIS; | ||
| if (useSameSideLength) |
There was a problem hiding this comment.
this boolean and code around it make no sense
| + makeSliderInput(null, 'ext_image_batcher_input_side_length', '', 'Input Side Length', '', 1024, 64, 4096, 64, 4096, 64, false, false, false) | ||
| + `</div>` | ||
| + `<span id="ext_image_batcher_output_side_length_wrap" style="display:none;width:100%;max-width:512px;">` | ||
| + makeSliderInput(null, 'ext_image_batcher_output_side_length', '', 'Output Side Length', '', 1024, 64, 4096, 64, 4096, 64, false, false, false) |
There was a problem hiding this comment.
This value makes no sense to have
Add "Scale Input To Side Length" Resolution Mode to Image Batch Tool
This was requested in Discord.
Adds a new resolution option to the Image Batch Tool that scales based on a target side-length pixel budget while preserving aspect ratio, with separate controls for input and output when needed.
What's New
Changes