prepareBitmapForSharing

open fun prepareBitmapForSharing(@NonNull context: Context, @NonNull bitmap: Bitmap): Single<Uri>

Writes bitmap to directory backed by DocumentSharingProvider.

Scheduler:
Method does not operate by default on a particular Scheduler.

Return

Single emitting Uri that can be used for sharing the bitmap file to other apps or an error if the bitmap could not be exported.

Parameters

context

Context to use.

bitmap

Bitmap that should be compressed and saved into file.


open fun prepareBitmapForSharing(@NonNull context: Context, @NonNull bitmap: Bitmap, @NonNull compressFormat: Bitmap.CompressFormat, compressQuality: Int, @Nullable fileName: String): Single<Uri>

Writes bitmap to directory backed by DocumentSharingProvider.

Scheduler:
Method does not operate by default on a particular Scheduler.

Return

Single emitting Uri that can be used for sharing the bitmap file to other apps or an error if the bitmap could not be exported.

Parameters

context

Context to use.

bitmap

Bitmap that should be compressed and saved into file.

compressFormat

The format of the compressed image.

compressQuality

The quality that compressor should use. Must be [0,100]. 0 means compress for small size, 100 means compress for max quality. Some lossless formats (for example PNG), ignore the quality setting.

fileName

Optional file name used for sharing (this is the shared file name as seen by other apps).