fix(studio): make image background removal reliable - #3969
Open
miguel-heygen wants to merge 2 commits into
Open
miguel-heygen wants to merge 2 commits into
miguel-heygen wants to merge 2 commits into
Conversation
Normalize project-local media src (including Studio preview URLs) so Remove BG works for images in both property panels, and cover the JPG-to-PNG default cutout path on the media route.
4 tasks
Preview bundles turn relative images into data URLs, which disabled Remove BG for images. Persist data-hf-authored-src on inline and prefer it when resolving the project asset path in both media inspectors.
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.
Summary
resolveProjectAssetPathhelper so both classic and flat media property panels normalize project-local image/videosrcvalues (relative paths and Studio/api/projects/.../preview/...URLs) before calling remove-background.http(s),data:,blob:,file:, protocol-relative, and non-preview/apiURLs; strip query/hash; safely URI-decode; normalize.//..segments.Test plan
bun run --cwd packages/studio test src/utils/projectAssetPath.test.ts src/components/editor/propertyPanelFlatMediaSection.test.tsx src/components/editor/propertyPanelMediaSection.test.tsxbun run --cwd packages/studio-server test src/routes/media.test.tsbunx oxlint+bunx oxfmt --checkon changed filessrcis an/api/projects/.../preview/...URL), confirm Remove BG is enabled, and that the cutout applies as a PNG underassets/cutouts/