Skip to main content
Native mobile apps benefit even more from image optimization than web — bandwidth is precious on mobile networks. Tenbyte transforms work over plain HTTP, so any networking library (OkHttp, URLSession, Glide, Coil, SDWebImage, Kingfisher) just works.

Pattern

Compute a URL from the view’s dimensions and the device’s pixel density, then hand the URL to your image loader.

Android (Java)

Usage with Glide:

Android (Kotlin)

Usage with Coil:

iOS (Swift)

Usage with SDWebImage:
Usage with Kingfisher:

iOS (SwiftUI)

Tips

  • Compute width after layout. Calling before layout returns 0. Use viewDidLayoutSubviews (UIKit) / onAppear (SwiftUI) / view-tree observers (Android).
  • Round to design tokens. A 123 px request and a 124 px request are two different cache entries. Snap widths to [160, 320, 480, 720, 1080] etc.
  • DPR clamp. dpr ≥ 4 rarely helps; clamp to min(actualDpr, 3).
  • Pre-fetch hero images during splash / loading for fast first paint.
  • Pair with library cache. Glide/Coil/SDWebImage/Kingfisher all cache by URL — Tenbyte’s cache + their disk cache = great offline UX.

Verify

Run the app and inspect the request URL in your debugger or proxy (Charles, Proxyman):
Response should be content-type: image/webp on Android (and image/heic or image/webp on iOS depending on negotiation).

Operational tips

  • Don’t ship the secret in the app. If you use Token Authentication, sign URLs server-side and hand them to the app via your API. Never embed the secret in the binary.
  • Long TTLs. Image paths should have multi-month TTLs in cache rules — saves origin egress and helps offline scenarios.