Skip to content

Kamera 1.0

Choose a tag to compare

@Kashif-E Kashif-E released this 19 Jun 09:22
879a9e0

Kamera (formerly CameraK) reaches 1.0 — a Kotlin Multiplatform camera library for Compose Multiplatform on Android, iOS, and Desktop.

Install

dependencies {
    implementation("io.github.kashif-mehmood-km:camerak:1.0")

    // optional plugins
    implementation("io.github.kashif-mehmood-km:image_saver_plugin:1.0")
    implementation("io.github.kashif-mehmood-km:qr_scanner_plugin:1.0")
    implementation("io.github.kashif-mehmood-km:ocr_plugin:1.0")
    implementation("io.github.kashif-mehmood-km:video_recorder_plugin:1.0")
    implementation("io.github.kashif-mehmood-km:analyzer_plugin:1.0")
}

Fixed

  • Android aspect ratio mismatch (#136#137): a configured ratio (e.g. RATIO_4_3) no longer produces a photo that's a crop of the full-screen field of view. The preview is now letterboxed to the configured ratio (FIT_CENTER) so what you see equals what you capture, driven by the actual screen orientation.
  • iOS underexposed / black photos (#138): fixed a MemoryManager miscalculation that reported 100% memory usage permanently, which made every capture downshift the session preset right before the shot — underexposing stills (most visibly front-camera selfies) while the preview looked fine.
  • Plugin lifecycle leaks (#140): plugins could stack analyzers/outputs on every camera re-init and leak coroutines/outputs past detach. All five plugins (ImageSaver, QR, OCR, Analyzer, VideoRecorder) now tear down and re-register idempotently; pluginScope is owned by the state holder and cancelled on shutdown; ImageSaver no longer double-saves after a re-attach; VideoRecorder guards double-start and won't hang on stop.

Added / Changed

  • CameraController.getAspectRatio() and an orientation-aware preview-ratio helper.
  • Plugin teardown APIs: removeImageCaptureListener(...), and on iOS safeRemoveOutput(...) / clearMetadataObjectsDelegate().
  • Result flows are buffered (DROP_OLDEST); OCR's ocrFlow is re-attach-safe.
  • Desktop saveImage writes to a real per-user directory and honors the configured format.
  • Improved barcode/QR detection (Android + iOS), mirrorFrontCamera option, opt-in CameraKLogger, channels→flows for the desktop pipeline, and the removal of deprecated/legacy APIs landed in the lead-up to 1.0 — see the changelog.

Requirements

Android API 21+ (CameraX) · iOS 13+ (AVFoundation) · Desktop JDK 17+ (JavaCV).

Thanks

A huge thank you to everyone who contributed code, fixes, demos, and bug reports that got Kamera to 1.0:

@ShadAdman · @shadman-sportsgamex · @zelitomas · @adamglin0 · @Martmists-GH · @raunovillberg · @licryle · @EsmaeelNabil · @juliusspencer · @jeremylcarter · @maciek-s · @RaedGhazal · @yannickpulver · @carlosftorres · @lopspower

And special thanks to @kanphis for the detailed Android aspect-ratio (#136) and iOS exposure (#138) reports plus on-device diagnosis. 🙏

Full details in CHANGELOG.md.