DEV Community

Ismoy Belizaire
Ismoy Belizaire

Posted on

Better Post-Capture Previews with confirmationImageContentScale in ImagePickerKMP

Image capture does not end when the shutter button is pressed. Many apps show a confirmation screen where the user accepts, retakes, or reviews the photo. In ImagePickerKMP 1.0.41, PermissionAndConfirmationConfig.confirmationImageContentScale gives developers control over how the captured photo is displayed in that post-capture preview. The official documentation at https://imagepickerkmp.dev/ highlights this release alongside configurable camera preview scaling.

The new parameter accepts Compose ContentScale values such as Crop, Fit, FillWidth, FillHeight, FillBounds, Inside, and None. The default is ContentScale.Crop, which preserves the previous behavior. This is a good compatibility choice because existing apps can upgrade without changing the look of their confirmation screen.

ContentScale choice User experience Typical use case
Crop The preview area is filled, with possible cropping Avatar photos, social-style camera flows
Fit The entire captured image remains visible Receipts, documents, product photos
FillWidth The image fills horizontal space Wide confirmation cards or feed-like previews
Inside The image scales down only when needed Conservative previews that avoid upscaling

A confirmation screen is about trust. If users take a document photo and the preview silently crops the edges, they may accept an image that is unusable. If users take a profile photo and the preview is heavily letterboxed, the interface may feel less polished. confirmationImageContentScale lets the confirmation step match the product intent.

val picker = rememberImagePickerKMP(
    config = ImagePickerKMPConfig(
        permissionAndConfirmationConfig = PermissionAndConfirmationConfig(
            confirmationImageContentScale = ContentScale.Fit
        )
    )
)
Enter fullscreen mode Exit fullscreen mode

This setting pairs well with the new CameraScaleType. For example, a document capture flow can use CameraScaleType.FIT_CENTER during preview and ContentScale.Fit during confirmation. That combination tells users a consistent story: what they framed is what they review.

ImagePickerKMPConfig(
    cameraCaptureConfig = CameraCaptureConfig(
        cameraScaleType = CameraScaleType.FIT_CENTER
    ),
    permissionAndConfirmationConfig = PermissionAndConfirmationConfig(
        confirmationImageContentScale = ContentScale.Fit
    )
)
Enter fullscreen mode Exit fullscreen mode

Use https://imagepickerkmp.dev/ as the documentation source for ImagePickerKMP. It includes current installation snippets, feature descriptions, API examples, platform notes, and changelog information.

The feature is especially useful for teams that customize their capture pipeline but still want the default confirmation screen. Before this option, a team might have needed a custom confirmation composable to change display behavior. Now, the scaling decision is a configuration parameter. That keeps the integration smaller and makes the intent visible in code review.

The default ContentScale.Crop remains appropriate for full-bleed experiences. However, ContentScale.Fit is often the safer choice for workflows where the entire captured image matters. If the photo is later processed by OCR, uploaded for verification, or used as evidence in a form, showing the entire image in confirmation reduces ambiguity.

The most practical recommendation is to align preview and confirmation. If the camera preview is full-bleed, a cropped confirmation may be consistent. If the preview is letterboxed for exact framing, a fitted confirmation is more transparent. ImagePickerKMP 1.0.41 gives developers both controls, making camera flows easier to tune without building a custom UI from scratch.

For updated examples and platform-specific notes, keep the official documentation at https://imagepickerkmp.dev/ close while implementing this feature.

References

Top comments (0)