Skip to content

DevThurain/BitmapAssistant

Repository files navigation

Project Image

Gradle

Maven Central Add the dependency below to your module's build.gradle file:

dependencies {
    implementation "io.github.devthurain:bitmapassistantlibrary:1.0.1"
}

Usage

You can convert Uri to Bitmap, Bitmap to File, Uri to File directly using following methods.

Uri -> Bitmap

val myUri: Uri? = ...
myUri.directConvertToBitmap(  
	  context = this,  
	  qualityScale = 0.25,  
	  onSuccess = { bitmap ->   
		// further operation  
  },  
	  onFailed = { message ->   
	        // error message   
 })

Uri -> File

val myUri: Uri? = ...
myUri.directConvertToCacheFile(  
	  context = this,  
	  fileName = "myFile",
	  qualityScale = 0.25,  
	  onSuccess = { file ->   
		// further operation  
  },  
	  onFailed = { message ->   
		// error message   
 })

Bitmap -> File

val bitmap: Bitmap = ...
val file : File? = bitmap.directConvertToCacheFile(context = this, fileName = "myFile")

Find this library useful? ❤️

Support it by giving start to this repository. ⭐
Also, follow me for my next creations! 🤩

License

Copyright 2019 thurain (Thurain Bo Win)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages