Skip to content

feat: several photos per item, front/back views, accessories and per-photo background removal - #283

Open
TheBlackSide243 wants to merge 8 commits into
Anyesh:mainfrom
TheBlackSide243:pr/item-photos
Open

TheBlackSide243 wants to merge 8 commits into
Anyesh:mainfrom
TheBlackSide243:pr/item-photos

Conversation

@TheBlackSide243

Copy link
Copy Markdown

Description

Several photos per item, with what each one shows, plus accessory sections and photos that are never cropped.

  • Several photos per item. An item can have up to 10 photos (MAX_ITEM_PHOTOS).
    • Each photo can be labelled front, back, detail or other.
    • The labels live in a new item_photo_views table. It is keyed by the photo's file, so a label follows the photo when it becomes or stops being the cover.
    • Nothing is added to clothing_items.
    • The gallery shows the labels, and a card shows the back on hover.
    • The photo manager can add, reorder, label, delete and set the cover. Changing the cover is refused (409) while a photo is still being processed.
  • Background removal on every photo.
    • Each photo has its own job on the image worker, with its own state and backup: item_images.status, original_image_path and processing_started_at, added by migration a4c6e8f0b2d3.
    • Uploads, the item's "Remove background" button and the bulk action clean all the photos, not only the cover.
    • Each photo can be redone or restored on its own.
    • The single-item removal now runs in the image worker instead of the API process. Before, it kept a second copy of the segmentation model in the API's memory.
  • Garments shown whole. Item photos use a shared garment-fit class (contain, centred) instead of object-cover. Trouser legs, sleeves and long dresses are no longer cut off.
  • Accessories and categories.
    • New types: ring, necklace, watch, bracelet and earrings.
    • A category filter on the wardrobe page: tops, bottoms, outerwear, shoes, accessories and others.
    • A category breakdown in analytics.
  • Palette. A softer palette with category, success, warning and info tokens.
  • Image worker resources.
    • rembg's CPU threads are capped with BG_REMOVAL_THREADS, default 2.
    • The model is freed after BG_REMOVAL_IDLE_SECONDS without photos, default 600.

Depends on #277 and #278. Both are merged into this branch, so the diff includes them until they land. Review those two first.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or build changes

Checklist

  • I have read the CONTRIBUTING guide
  • My code follows the project's coding style
  • I have added tests that prove my fix/feature works
  • New and existing tests pass locally
  • I have updated documentation as needed
  • My changes don't introduce new warnings or errors

Testing

  • Backend (on top of current main plus feat: remove the background while uploading #277 and feat: more accurate background removal for clothes #278):
    • ruff check and ruff format --check;
    • the migration heads check;
    • the full pytest suite.
  • Frontend:
    • npm run lint, i18n:check and tsc --noEmit;
    • vitest.
  • By hand on my own instance (Docker Compose on TrueNAS):
    • an item with front and back photos;
    • background removal on every photo, then restoring one;
    • changing the cover and deleting one photo;
    • a ring tagged as an accessory;
    • full-length trousers shown without cropping.

Test Environment

  • Docker Compose
  • Kubernetes
  • Local development

🤖 Generated with Claude Code

TheBlackSide243 and others added 8 commits October 15, 2026 14:45
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d 'fork/pr/background-removal-accuracy' into pr/item-photos
The upload handlers queued background removal only together with AI
tagging, so with tagging skipped or disabled the option was silently
ignored. The removal is now queued on its own and the worker marks the
item ready; a failed enqueue no longer strands the item in processing.
The 'only tags' test asserts the single tagging job and its queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Backups are written through a temporary file and swapped in, so an
  interrupted write never leaves a truncated original to restore from.
- Rotation turns the backup only after the photo and its sizes are saved.
- Smaller detached parts (straps, hoods) are kept and small garments such
  as jewellery are no longer rejected as empty cut-outs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…per-photo background removal

- Up to 10 photos per item; each can be labelled front, back, detail or
  other (item_photo_views table, keyed by the photo's file so the label
  follows it when it becomes the cover). The gallery and the card show
  the back on hover.
- Background removal runs per photo on the image worker, with its own
  status and backup (item_images.status / original_image_path /
  processing_started_at); the item's button and the bulk action also
  clean the other photos, and each photo can be restored.
- Photos are shown whole (object-fit: contain), never cropped.
- Accessory types (ring, necklace, watch, bracelet, earrings) and a
  category filter (tops, bottoms, outerwear, shoes, accessories...) on
  the wardrobe page, with a category breakdown in analytics.
- A softer colour palette with category, success, warning and info tokens.
- The image worker caps rembg's threads and frees the model after 10
  minutes idle (BG_REMOVAL_THREADS, BG_REMOVAL_IDLE_SECONDS).

Builds on Anyesh#277 and Anyesh#278 (merged in here); the diff shrinks once they land.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Oct 18, 2026

Copy link
Copy Markdown

Sorry @TheBlackSide243, your pull request is larger than the review limit of 150,000 diff characters

@github-actions github-actions Bot added docker Pull requests that update docker code javascript Pull requests that update javascript code python Pull requests that update python code labels Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Pull requests that update docker code javascript Pull requests that update javascript code python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants