saveImageToGallery

suspend fun FileKit.saveImageToGallery(output: MediaSink, filename: String? = null): Result<Unit>(source)

Saves a still into the platform's image gallery.

Android inserts it into MediaStore, Apple adds it to the photo library and the JVM copies it into the user's pictures directory. The same plist key and the same pre-29 Android permission as the video overload apply.

Return

Result.failure when the save does not go through. It carries an IllegalStateException for MediaSink.Temporary, which is a request rather than a location, so read the resolved path off ExportStatus.Success.output instead. A MediaSink.Uri this platform cannot parse carries an IllegalArgumentException, and anything else is FileKit's own exception.

Parameters

output

Where the still was written, taken whole so a content:// destination stays one.

filename

The name the gallery entry takes, defaulting to the written file's own name.