Repository navigation
feat(image-studio): crop, auto-frame and model preview (T-M3) - #460
Merged
Merged
Conversation
Crop trims a percentage off each edge. Auto-frame recenters the subject on its alpha bounding box and pads it to a transparent square at a chosen resolution with a uniform margin, so generators get a framed input instead of cropping it each their own way.
A canvas toggle shows the selected file exactly as Generate uploads it, at its own resolution with its edges outlined, and says when it is not square. Crop's four edges sit in two columns in the toolbar.
…o-frame Auto-frame now refuses an image whose alpha channel has no transparent pixel (clipboard pastes, screenshots) instead of letterboxing the whole picture. RGB and L PNGs with a tRNS colour key count as transparent, so crop keeps their transparency and auto-frame accepts them. Crop checks the mode and info only, and auto-frame reads the uint8 alpha directly.
The ops share the canvas busy overlay, so a fast op finishing (Crop) cleared it while Remove background was still running. A shared run lock now lets one op run at a time and disables the others meanwhile.
POST /image/op/{op} read any absolute path on disk. The input is now
resolved (collapsing `..` and following symlinks) and refused with 403
`outside_workspace` unless it lies inside the workspace. The Image Studio
copies an image opened from elsewhere into <workspace>/Images once and
runs the op on that copy.
…download The op the user asked for runs once the one-time download finishes. It used the params captured when Download was clicked, so changes made during the install were ignored; it now reads them when it starts.
Hiding the mask revoked its object URL but kept it in state, so showing the same mask again displayed a broken image. The state is now cleared with the URL.
…s them
GET /image/ops returns each requirement as {kind, id, label}, not a string.
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.
Closes #422
What
Review fixes for code merged in #457
These are separate commits on this branch, because they touch the same files.
/image/op/*now only reads files inside the workspace, checked after resolving the path, so..and symlinks pointing out are refused too. Anything else gets a 403. When an image was opened from elsewhere, the renderer copies it into<workspace>/Imagesthrough Electron and runs the op on the copy.requirementstype matches whatdescribe()returns.Tests
npm run lint,npm run test(Python 532 OK, JS 0 failures) andnpm run buildpass. Not yet tested by hand in the app.