android-photo-manipulator

所属分类:编辑器/阅读器
开发工具:kotlin
文件大小:0KB
下载次数:0
上传日期:2021-09-21 01:41:14
上 传 者sh-1993
说明:  用于在Android中以编程方式编辑照片的图像处理库。它可以打印文本,覆盖其他图像(添加水印),调整大小,裁剪...,
(Image processing library to edit photo programmatically in Android. It can print text, overlay other image (add watermark), resize, crop and optimize image size, convert format to jpeg or png)

文件列表:
LICENSE (1082, 2021-09-20)
app/ (0, 2021-09-20)
app/build.gradle (1299, 2021-09-20)
app/proguard-rules.pro (751, 2021-09-20)
app/src/ (0, 2021-09-20)
app/src/androidTest/ (0, 2021-09-20)
app/src/androidTest/java/ (0, 2021-09-20)
app/src/androidTest/java/com/ (0, 2021-09-20)
app/src/androidTest/java/com/guhungry/ (0, 2021-09-20)
app/src/androidTest/java/com/guhungry/photomanipulator/ (0, 2021-09-20)
app/src/androidTest/java/com/guhungry/photomanipulator/demo/ (0, 2021-09-20)
app/src/androidTest/java/com/guhungry/photomanipulator/demo/ExampleInstrumentedTest.kt (682, 2021-09-20)
app/src/main/ (0, 2021-09-20)
app/src/main/AndroidManifest.xml (824, 2021-09-20)
app/src/main/java/ (0, 2021-09-20)
app/src/main/java/com/ (0, 2021-09-20)
app/src/main/java/com/guhungry/ (0, 2021-09-20)
app/src/main/java/com/guhungry/photomanipulator/ (0, 2021-09-20)
app/src/main/java/com/guhungry/photomanipulator/demo/ (0, 2021-09-20)
app/src/main/java/com/guhungry/photomanipulator/demo/MainActivity.kt (317, 2021-09-20)
app/src/main/res/ (0, 2021-09-20)
app/src/main/res/drawable-v24/ (0, 2021-09-20)
app/src/main/res/drawable-v24/ic_launcher_foreground.xml (1969, 2021-09-20)
app/src/main/res/drawable/ (0, 2021-09-20)
app/src/main/res/drawable/ic_launcher_background.xml (4887, 2021-09-20)
app/src/main/res/layout/ (0, 2021-09-20)
app/src/main/res/layout/activity_main.xml (835, 2021-09-20)
app/src/main/res/mipmap-anydpi-v26/ (0, 2021-09-20)
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml (270, 2021-09-20)
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml (270, 2021-09-20)
app/src/main/res/mipmap-hdpi/ (0, 2021-09-20)
app/src/main/res/mipmap-hdpi/ic_launcher.png (2963, 2021-09-20)
app/src/main/res/mipmap-hdpi/ic_launcher_round.png (4905, 2021-09-20)
... ...

# Android Photo Manipulator [![Build and Test](https://github.com/guhungry/android-photo-manipulator/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/guhungry/android-photo-manipulator/actions/workflows/build-and-test.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=guhungry_android-photo-manipulator&metric=alert_status)](https://sonarcloud.io/dashboard?id=guhungry_android-photo-manipulator) [![codecov](https://codecov.io/gh/guhungry/android-photo-manipulator/branch/master/graph/badge.svg)](https://codecov.io/gh/guhungry/android-photo-manipulator) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.guhungry.android/photo-manipulator/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.guhungry.android/photo-manipulator) Image processing library to edit image programmatically. ## Installation Add dependency in module `build.gradle` ```gradle repositories { mavenCentral() } dependencies { implementation 'com.guhungry.android:photo-manipulator:1.0.2' } ``` ## Usage BitmapUtils Import using `import com.guhungry.photomanipulator.BitmapUtils` ### BitmapUtils.readImageDimensions() Get width and height of image in `CGSize` | NAME | TYPE | REQUIRED | DESCRIPTION | |------------|-----------------------|----------|------------------------------| | image | Bitmap | Yes | Source image | ### BitmapUtils.crop() Crop image from specified `cropRegion` | NAME | TYPE | REQUIRED | DESCRIPTION | |------------|-----------------------|----------|-----------------------------------------------------------| | image | Bitmap | Yes | Source image to be crop and resize | | cropRegion | CGRect | Yes | Region to be crop in CGRect(`x`, `y`, `size`, `width`) | | outOptions | BitmapFactory.Options | Yes | Configuration for decode and encode result bitmap | ### BitmapUtils.cropAndResize() Crop and resize image from specified `cropRegion` into `targetSize` using resize mode `cover` | NAME | TYPE | REQUIRED | DESCRIPTION | |------------|-----------------------|----------|-----------------------------------------------------------| | image | Bitmap | Yes | Source image to be crop and resize | | cropRegion | CGRect | Yes | Region to be crop in CGRect(`x`, `y`, `size`, `width`) | | targetSize | CGSize | Yes | Size of result image | | outOptions | BitmapFactory.Options | Yes | Configuration for decode and encode result bitmap | | matirx | Matrix | No | Orientation transform matrix from [getCorrectOrientationMatrix()](#bitmaputilsgetcorrectorientationmatrix) | ### BitmapUtils.printText() Print text into image | NAME | TYPE | REQUIRED | DESCRIPTION | |------------|-----------------------|----------|------------------------------------------------------------------------| | image | Bitmap | Yes | Source image to be crop and resize | | text | String | Yes | Text to print in image | | position | PointF | Yes | Position to in in `x`, `y` | | color | Int | Yes | Text color | | textSize | Float | Yes | Text size | | font | Typeface | No | Font use to print. Default = App's Default Font | | alignment | Paint.Align | No | Text alignment (`left`, `right` and `center`). Default = `left` | | thickness | Float | No | Outline of text. Default = 0 | ### BitmapUtils.overlayImage() Overlay image on top of background image | NAME | TYPE | REQUIRED | DESCRIPTION | |------------|-----------------------|----------|------------------------------------------------------------------------| | background | Bitmap | Yes | Background image | | overlay | Bitmap | Yes | Overlay image | | position | PointF | Yes | Position of overlay image in background image | ### BitmapUtils.getCorrectOrientationMatrix() Get correct transform matrix for orientation data in EXIF | NAME | TYPE | REQUIRED | DESCRIPTION | |------------|-----------------------|----------|------------------------------------------------------------------------| | image | InputStream | Yes | Image input stream | ## Usage FileUtils Import using `import com.guhungry.photomanipulator.FileUtils` ### FileUtils.createTempFile() Create temp file into cache directory with prefix | NAME | TYPE | REQUIRED | DESCRIPTION | |------------|-----------------------|----------|-------------------------------------------------| | context | Context | Yes | Android context | | prefix | String | Yes | Temp file name prefix | | mimeType | String | Yes | Mime type of image. Default = image/jpeg | ### FileUtils.cachePath() Get cache path of app | NAME | TYPE | REQUIRED | DESCRIPTION | |------------|-----------------------|----------|-------------------------------------------------| | context | Context | Yes | Android context | ### FileUtils.cleanDirectory() Delete all files in directory with prefix | NAME | TYPE | REQUIRED | DESCRIPTION | |------------|-----------------------|----------|-------------------------------------------------| | directory | File | Yes | Path to clean | | prefix | String | Yes | File name prefix to match | ### FileUtils.openBitmapInputStream() Open file from uri as input stream | NAME | TYPE | REQUIRED | DESCRIPTION | |------------|-----------------------|----------|------------------------------------------------------------------------------------------| | context | File | Yes | Path to clean | | uri | String | Yes | Uri of image can be remote (https?://) or local (file://, android.res:// and content://) | ## Usage MimeUtils Import using `import com.guhungry.photomanipulator.MimeUtils` ### MimeUtils.toExtension() Get image file extension from mimeType (Support .jpg, .png and .webp) | NAME | TYPE | REQUIRED | DESCRIPTION | |------------|-----------------------|----------|-------------------------------------------------| | mimeType | String | Yes | Image mime type | ### MimeUtils.toCompresFormat() Get image `Bitmap.CompressFormat` from mimeType (Support .jpg, .png and .webp) | NAME | TYPE | REQUIRED | DESCRIPTION | |------------|-----------------------|----------|-------------------------------------------------| | mimeType | String | Yes | Image mime type |

近期下载者

相关文件


收藏者