public class Resizer
extends java.lang.Object
Constructor and Description |
---|
Resizer(android.content.Context context)
The constructor to initialize Resizer instance.
|
Modifier and Type | Method and Description |
---|---|
android.graphics.Bitmap |
getResizedBitmap()
Get the resized image bitmap.
|
io.reactivex.Flowable<android.graphics.Bitmap> |
getResizedBitmapAsFlowable()
Get the resized image bitmap as RxJava Flowable.
|
java.io.File |
getResizedFile()
Get the resized image file.
|
io.reactivex.Flowable<java.io.File> |
getResizedFileAsFlowable()
Get the resized image file as RxJava Flowable.
|
Resizer |
setOutputDirPath(java.lang.String outputDirPath)
Set the output directory path.
|
Resizer |
setOutputFilename(java.lang.String filename)
Set the output file name.
|
Resizer |
setOutputFormat(android.graphics.Bitmap.CompressFormat compressFormat)
Set the image compression format by Bitmap.CompressFormat.
|
Resizer |
setOutputFormat(java.lang.String outputFormat)
Set the image compression format by String.
|
Resizer |
setQuality(int quality)
Set the image quality.
|
Resizer |
setSourceImage(java.io.File sourceImage)
Set the source image file.
|
Resizer |
setTargetLength(int targetLength)
Set the target length of the image.
|
public Resizer(android.content.Context context)
context
- The global application context. You can get it by getApplicationContext().public Resizer setTargetLength(int targetLength)
targetLength
- The target image length in pixel. The default value is 1080.public Resizer setQuality(int quality)
quality
- The image quality value, ranges from 0 to 100. The default value is 80.public Resizer setOutputFormat(java.lang.String outputFormat)
outputFormat
- The compression format. The default format is JPEG.public Resizer setOutputFormat(android.graphics.Bitmap.CompressFormat compressFormat)
compressFormat
- The compression format. The default format is JPEG.public Resizer setOutputFilename(java.lang.String filename)
filename
- The name of the output file, without file extension.public Resizer setOutputDirPath(java.lang.String outputDirPath)
outputDirPath
- The path of the output directory. The default path is the external files directory of your apppublic Resizer setSourceImage(java.io.File sourceImage)
sourceImage
- The source image file to be resized.public java.io.File getResizedFile() throws java.io.IOException
java.io.IOException
public android.graphics.Bitmap getResizedBitmap() throws java.io.IOException
java.io.IOException
public io.reactivex.Flowable<java.io.File> getResizedFileAsFlowable()
public io.reactivex.Flowable<android.graphics.Bitmap> getResizedBitmapAsFlowable()