◉RORK LABJP
●SUBDOMAIN — Rork can now connect your web app to a subdomain only, leaving your root domain and www untouched (12/1)●UPDATES — expo-updates 58.0.23 fixes Android release builds embedding a stale runtime version●FLASH END — Intro pricing for Gemini Flash models ends 12/31, 29 days from now. Time to recheck AI feature costs●HMR — Some report the dev server picking up another server's bundle and then exiting●FIRST VIEW — Map the first screen for a normal launch, a notification, and a link, and back navigation stops surprising you●CARBON — Gemini 4 Carbon and Argon are now at standard rates: $4.00 input, $20.00 output per 1M tokens●SUBDOMAIN — Rork can now connect your web app to a subdomain only, leaving your root domain and www untouched (12/1)●UPDATES — expo-updates 58.0.23 fixes Android release builds embedding a stale runtime version●FLASH END — Intro pricing for Gemini Flash models ends 12/31, 29 days from now. Time to recheck AI feature costs●HMR — Some report the dev server picking up another server's bundle and then exiting●FIRST VIEW — Map the first screen for a normal launch, a notification, and a link, and back navigation stops surprising you●CARBON — Gemini 4 Carbon and Argon are now at standard rates: $4.00 input, $20.00 output per 1M tokens
Articles/AI Models
◉ AI Models/2026-04-12Advanced

Building an AI Photo Editor App with Rork — Filters, Background Removal, and Style Transfer in Production

Implementation notes from building an AI photo editor with Rork — non-destructive editing, background removal with fallbacks, style transfer, and picking preview resolution from device memory, with working code and the reasoning behind each call.

rork60AI31photo editorimage processingbackground removalReact Native244app development39

✦ Premium Article

The Gap Between "I Want to Build a Photo App" and Actually Shipping One

Applying filters to photos, removing backgrounds with a tap, transforming snapshots into watercolor paintings — these features feel magical as a user, but overwhelming as a developer. Where do you even start? How do you handle pixel manipulation on mobile? Which background removal API actually delivers? What happens to your UI while the AI crunches for 20 seconds?

When I built this app with Rork, the first lesson hit early: image editing apps are won on UI and waiting-time design more than on algorithms. Libraries and APIs handle the heavy computation, but nobody handles the experience of waiting, the precision of undo/redo, or the feeling of control over filter intensity. Those decisions must be made before writing a single line of processing logic.

What follows is the implementation record of an AI photo editor built with Rork's prompt-based development — filters, AI background removal, style transfer, and export with sharing. Each snippet comes with the reasoning behind the call.

Ninety Seconds — The Gate That Decides Whether a Photo Editor Survives

Whether a photo editor keeps its users comes down, more than anything, to how quickly it delivers a first success after launch. By "success" I mean the whole path: launch → photo selection → one-tap filter → share candidate visible. The 90-second line is a design target I set, not a number derived from industry statistics. In your own app, put time-to-first-success and 7-day retention on the same screen and see where the curve bends.

Three things I do not skip on the first screen:

  1. Don't trigger the photo library permission dialog right after launch. A permission request before the app has said what it is gets declined more often. Show a screen that makes the usage obvious first, and ask just before the user picks a photo. If you only need to save, iOS offers write-only access (MediaLibrary.requestPermissionsAsync(true)), so you don't need access to the whole library.
  2. Pin the share button to a thumb-reachable spot at the bottom after a filter is applied. If it sits below the fold, the app doesn't read as "shareable." Compare share rate before and after the change, and trust your own numbers.
  3. Within the first 30 seconds, show the user's own photo transforming. Skip the tutorial that edits someone else's picture; let a single tap change theirs.

The fork in the road for a photo editor is not the feature count. It is whether, within the first few dozen seconds, users feel "my photo just got better."

Code-Level Insight: Two-Stage Image Compression

Downsample the image to preview resolution (1080px long edge) before filtering, and replay the operations against the original only at export time. This two-stage approach keeps memory problems in check. A 12-megapixel image (4032 × 3024) occupies about 48MB once decoded (4 bytes per pixel × roughly 12.2 million pixels), and holding that full image through every operation invites background termination.

// services/image-pipeline.ts
import { ImageManipulator, SaveFormat } from 'expo-image-manipulator';
 
// Edit operations are recorded as functions applied to a manipulator context
type EditOp = (ctx: ReturnType<typeof ImageManipulator.manipulate>) => void;
 
interface ImageState {
  originalUri: string;        // never touched while editing
  previewUri: string;         // 1080px long edge, for filter previews
  exportPipeline: EditOp[];   // replayed at export time
}
 
const PREVIEW_LONG_EDGE = 1080;
 
export async function loadImageForEditing(uri: string): Promise<ImageState> {
  // Render with no operations to learn the original dimensions
  const probe = await ImageManipulator.manipulate(uri).renderAsync();
  if (Math.max(probe.width, probe.height) <= PREVIEW_LONG_EDGE) {
    // Never upscale small images
    return { originalUri: uri, previewUri: uri, exportPipeline: [] };
  }
 
  // Specify only the long edge; the other side follows the aspect ratio
  const ctx = ImageManipulator.manipulate(uri);
  ctx.resize(
    probe.width >= probe.height
      ? { width: PREVIEW_LONG_EDGE }
      : { height: PREVIEW_LONG_EDGE },
  );
  const preview = await (await ctx.renderAsync()).saveAsync({
    compress: 0.85,
    format: SaveFormat.JPEG,
  });
 
  return { originalUri: uri, previewUri: preview.uri, exportPipeline: [] };
}
 
export async function exportWithFullQuality(
  state: ImageState,
): Promise<string> {
  // Replay every operation in one context; write the JPEG exactly once, at the end
  const ctx = ImageManipulator.manipulate(state.originalUri);
  for (const op of state.exportPipeline) op(ctx);
  const ref = await ctx.renderAsync();
  const result = await ref.saveAsync({
    compress: 0.92,
    format: SaveFormat.JPEG,
  });
  return result.uri;
}

The design has two benefits. Previews run on a small image, so they respond quickly. And the export writes a JPEG once; saving a JPEG after every operation loses a little quality each generation, a pattern that is common in the wild. One more trap: passing only width to resize leaves a portrait photo's long edge far above 1080px. To size by the long edge, look at the orientation and switch which side you specify.

Preview latency and crash rates vary widely by device, so I won't quote figures here. Time the filter pass with performance.now(), and watch crash rate per device model in something like Crashlytics.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦A launch flow built around a first success within 90 seconds, plus the metrics to re-measure it in your own app
✦A two-stage pipeline: shrink for preview, write the export once at full resolution (long-edge based, new expo-image-manipulator API)
✦Choosing preview resolution from device memory, and the edge refinement that fixes cutout quality
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

◉ AI Models2026-03-26
Taking Rork × Supabase pgvector Semantic Search to Production: Index Choice, Incremental Re-embedding, and Hybrid Retrieval
How to run semantic search in a Rork app for real. Measure HNSW against IVFFlat, cut embedding API calls with content hashing, and fuse vector search with full-text search using RRF.
◉ AI Models2026-09-28
Keep Fixing in the Same Thread, or Restore and Rephrase? What I Learned Fixing One Rork Bug Both Ways
When a Rork fix request fails for the third time, do you keep going or use Restore and ask differently? I fixed the same bug both ways and compared round trips, leftover code, and where I now draw the line.
◉ AI Models2026-08-07
Cutting MCP Tools Didn't Make Anything Lighter — 2,377 Bytes of Definitions vs 110,298 Bytes of Response
I wrote a minimal MCP server for a wallpaper catalog and measured the byte cost of tool definitions against the byte cost of responses. Here is which side actually matters, and the real reason to merge tools.