Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.handysolver:ImageCompressor:0.1.1'
}
dependencies {
implementation("com.github.handysolver:ImageCompressor:0.1.1")
}
<dependency>
<groupId>com.github.handysolver</groupId>
<artifactId>ImageCompressor</artifactId>
<version>0.1.1</version>
</dependency>
libraryDependencies += "com.github.handysolver" % "ImageCompressor" % "0.1.1"
:dependencies [[com.github.handysolver/ImageCompressor "0.1.1"]]
A simple library that compresses image with user defined height and width and save it to user defined external storage folder path.
Add it in your root build.gradle at the end of repositories
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Add the dependency
dependencies {
compile 'com.github.handysolver:ImageCompressor:0.1.0'
}
ImageCompressor.create(this)
.setImageUriPath(imageUri) // set image Uri path
.setImageStringPath(imageString) // or you can set image String path
.setRealImageFolderPath("handysolver/real") // set folder name where Compressed image will be saved
.setThumbnailImageFolderPath("handysolver/thumbnail") // set folder name where Compressed thumbnail image will be saved
.setRealImageMaxWidth(80.0f) // set width of image to be Compressed. default is 80.0f [optional]
.setRealImageMaxHeight(80.0f) // set height of image to be Compressed. default is 80.0f [optional]
.setThumbnailImageMaxHeight(612.0f) // set height of thumbnail image to be Compressed. default is 612.0f [optional]
.setThumbnailImageMaxWidth(816.0f) // set width of thumbnail image to be Compressed. default is 816.0f [optional]
.start(new ImageCompress() {
@Override
public void onFailure(String message) {
Log.d("error", "onFailure: "+message); // error message
}
@Override
public void onSuccess(ImagePathContainer imagePathContainer) {
// on success you will receive path[External storage path] of two image saved in storage
Log.d("getRealImagePath", "onSuccess: " +imagePathContainer.getRealImagePath());
Log.d("getThumbnailImagePath", "onSuccess: " +imagePathContainer.getRealImagePath());
}
}); // Start ImagePicker