All products
Beta

Ranqian

Try 64 hair colours on your own photo before you dye. Everything runs in the browser, and your photo never leaves your device.

  • AI product
  • Computer vision
  • On-device inference
  • PWA
  • Privacy-first
Coming soon

The problem

Dyeing your hair is expensive, slow and hard to undo. A swatch on a colour chart tells you little about how the shade will look on you, and most try-on apps want a download, an account and your selfie on their servers.

Ranqian (染前, “before you dye”) turns that into opening a web page. Pick a photo of yourself, tap a colour, and see roughly how it would look. Try the colour first, then decide.

What it does

  • Photo try-on: upload a photo or take one. Hair is detected automatically and recoloured the moment you tap a swatch.
  • 64 shades: eight families (black, warm brown, cool brown and grey, blonde, copper and red, pink, purple, blue and green), plus 12 everyday picks and a custom colour picker.
  • Before and after: drag a divider across the photo to compare the original with the preview.
  • Shortlist: save up to four looks side by side and export a single image or a comparison sheet.
  • Live try-on (experimental): see the colour on your camera feed, with front and rear camera switching.
  • Installable and offline: add it to your home screen and it opens like an app. Once cached, it works without a connection.

How to use it

  1. Open ranqian.byjandle.com in a mobile browser. No download, no sign-up.
  2. Tap “选照片” (choose photo) or “拍照试色” (take photo). A front-facing, evenly lit photo with all of your hair in frame works best.
  3. Wait a second or two for detection, then tap any colour.
  4. Use “原图对比” to compare, “收藏” to shortlist, and save the image when you are happy.

The first visit downloads about 29 MB of model and runtime files, which are reused afterwards.

Technical highlights

  • On-device AI, no backend: a portrait segmentation model (MediaPipe SelfieMulticlass) runs in the browser through WebAssembly. Detection and recolouring both happen on the device. There is no server, no account system and no request that uploads a photo.
  • Custom recolouring algorithm: hue replacement and light preservation are handled separately and composited in linear colour space, with skin protection and hair-edge refinement. It went through five documented iterations, each with same-photo comparisons.
  • Offline-first PWA: the service worker verifies every cached asset with SHA-256, supports version migration and user-initiated updates, and clears the previous version’s cache when a new one takes over.
  • Built for slow networks: the first-visit download of about 29 MB times out on lack of progress, not on total duration, and resumes from where a dropped connection stopped. It works on a 130 KB/s link.
  • Privacy and security by default: a strict Content Security Policy allows same-origin resources only. The camera is requested only after a tap and released as soon as you leave the page.
  • Engineering discipline: framework-free native ES modules with no bundler, an allow-list build that is reproducible, and more than a hundred automated tests covering colour, masks, offline behaviour, weak networks and the camera lifecycle.

Known limits

Ranqian simulates appearance, not a dye formula. Light shades on dark hair look subtle because it does not simulate bleaching, and the interface says so when that happens. Very fine strands, low light or busy backgrounds can be detected imperfectly, and fully blown-out hair is left uncoloured. The interface is currently Chinese only, and there is no built-in sample photo: you try colours on your own.