Skip to content

Open-source Android PDF and document toolkit with PDF tools, Office viewing, XLSX editing, scanning, and image editing. Built with Kotlin and Jetpack Compose.

Switch to upstream GPUImage 2.1.0; add ImageToolbox/GPUImage/ML Kit attribution

Chethan616bc9dafa4c6ed
diff --git a/NOTICE b/NOTICE
index cc6ace5..b2392b9 100644
--- a/NOTICE
+++ b/NOTICE
@@ -14,4 +14,13 @@ port of Apache PDFBox (https://pdfbox.apache.org/).
This project uses Google ML Kit (document scanner and on-device text recognition)
for the scanning and text-selection features only.
+The image editor adapts source code from ImageToolbox by T8RIN (Malik Mukhametzyanov),
+Copyright (c) 2026, licensed under the Apache License, Version 2.0.
+Source: https://github.com/T8RIN/ImageToolbox
+Adapted files keep their original Apache-2.0 header plus a "Modified by ClearPDF" line:
+the Compose cropper (lib/cropper), gesture helpers (lib/gesture), image-scope helpers
+(lib/image), the free-corners perspective cropper (lib/opencv-tools, with OpenCV replaced
+by android.graphics.Matrix), and draw-engine geometry/paint/flood-fill code (feature/draw).
+The image editor also depends on GPUImage for Android by CyberAgent (Apache-2.0).
+
ClearPDF remains licensed under the MIT License (see LICENSE).
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
index 456d2d0..be142f3 100644
--- a/THIRD_PARTY_NOTICES.md
+++ b/THIRD_PARTY_NOTICES.md
@@ -70,3 +70,37 @@ The app does not add GPL or LGPL components for document rendering. If a future
- Use: required by docx-preview to read the .docx zip container in the browser context.
- Notice practice: the upstream banner (including its pako attribution) is preserved verbatim at the
top of the vendored file, and the library is credited in Settings → Licenses.
+
+## ImageToolbox (adapted source)
+
+- Source: https://github.com/T8RIN/ImageToolbox — Copyright (c) 2026 T8RIN (Malik Mukhametzyanov)
+- License: Apache License 2.0
+- Use: the image editor's cropper (`imageeditor/thirdparty/cropper`, from `lib/cropper` minus
+ its widgets), gesture helpers (`thirdparty/gesture`), image-scope helpers (`thirdparty/image`),
+ the perspective cropper (`thirdparty/freecorners`, from `lib/opencv-tools/free_corners_crop`
+ with OpenCV's `warpPerspective` replaced by `Matrix.setPolyToPoly`), and draw-engine code
+ (`imageeditor/engine/draw`: shape/arrow geometry from `PathHelper.kt`, paint set-up from
+ `DrawUtils.kt`, `FloodFill.kt`). Adjustment/preset choices and the watermark placement model
+ follow `feature/filters` and `feature/watermarking`.
+- Notice practice: every adapted file keeps the upstream Apache-2.0 header with an added
+ "Modified by ClearPDF" line; attribution is also in `NOTICE` and Settings → Licenses.
+
+## GPUImage for Android
+
+- Artifact: `jp.co.cyberagent.android:gpuimage:2.1.0` (Maven Central; ~0.2 MB incl. a tiny native helper)
+- License: Apache License 2.0 (CyberAgent, Inc.)
+- Use: GL-accelerated adjustments (white balance, vibrance, gamma, sharpen, vignette) and
+ artistic presets in the image editor.
+
+## Google ML Kit Subject Segmentation
+
+- Artifact: `com.google.android.gms:play-services-mlkit-subject-segmentation:16.0.0-beta1`
+- License: Google APIs Terms of Service
+- Use: optional automatic background removal in the image editor. The model is delivered by
+ Google Play services; the call is gated at runtime (Android 7+, Play services present) behind
+ the `BackgroundRemover` interface so FOSS builds can swap or drop it.
+
+## Stack Blur
+
+- Algorithm by Mario Klingemann (public domain), re-implemented in `imageeditor/engine/BlurUtils.kt`
+ as the pre-Android-12 fallback for the blur brush.
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index a1853af..2dfcff1 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -161,10 +161,11 @@ dependencies {
implementation(libs.acccompanist.permissions)
implementation("androidx.documentfile:documentfile:1.0.1")
- // Image editor: GPUImage (T8RIN fork, ~0.2 MB) for GL adjustments/filters, EXIF read/strip,
+ // Image editor: GPUImage (upstream 2.1.0, ~0.2 MB; the T8RIN 8.x fork needs compileSdk 37
+ // + desugaring and drags in androidx.core 1.19) for GL adjustments/filters, EXIF read/strip,
// and ML Kit subject segmentation for auto background removal (API 24+, gated at runtime;
// isolated behind BackgroundRemover so a FOSS flavor can swap it out).
- implementation(libs.toolbox.gpuimage)
+ implementation(libs.gpuimage)
implementation(libs.androidx.exifinterface)
implementation(libs.mlkit.subject.segmentation)
}
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/SettingsScreen.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/SettingsScreen.kt
index 3ed9414..86d4878 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/screen/SettingsScreen.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/SettingsScreen.kt
@@ -820,6 +820,21 @@ private val OpenSourceCredits = listOf(
"MIT License (used under MIT of its MIT/GPLv3 dual licence)",
"https://github.com/Stuk/jszip"
),
+ Credit(
+ "ImageToolbox", "T8RIN (Malik Mukhametzyanov)",
+ "Apache License 2.0 — image editor cropper, perspective crop and draw engine (adapted)",
+ "https://github.com/T8RIN/ImageToolbox"
+ ),
+ Credit(
+ "GPUImage for Android", "CyberAgent, Inc.",
+ "Apache License 2.0 — image editor adjustments and filters",
+ "https://github.com/cats-oss/android-gpuimage"
+ ),
+ Credit(
+ "ML Kit Subject Segmentation", "Google",
+ "Google APIs Terms — optional background removal via Play services",
+ "https://developers.google.com/ml-kit/vision/subject-segmentation"
+ ),
Credit(
"Pdf_Tools", "Karna14314",
"PDF viewer zoom/pan reference",
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 46160ab..89ef531 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -19,7 +19,7 @@ accompanist = "0.36.0"
pdfbox = "2.0.27.0"
kotlinxCoroutines = "1.10.2"
tesseract4android = "4.9.0"
-toolboxGpuimage = "8.0.8"
+gpuimage = "2.1.0"
exifinterface = "1.3.7"
mlkitSubjectSegmentation = "16.0.0-beta1"
@@ -40,7 +40,7 @@ androidx-lifecycle-viewmodel-compose = { group = "androidx.lifecycle", name = "l
androidx-lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycle" }
# Image editor (ImageToolbox-derived; see THIRD_PARTY_NOTICES.md)
-toolbox-gpuimage = { group = "com.github.T8RIN.ImageToolboxLibs", name = "gpuimage", version.ref = "toolboxGpuimage" }
+gpuimage = { group = "jp.co.cyberagent.android", name = "gpuimage", version.ref = "gpuimage" }
androidx-exifinterface = { group = "androidx.exifinterface", name = "exifinterface", version.ref = "exifinterface" }
mlkit-subject-segmentation = { group = "com.google.android.gms", name = "play-services-mlkit-subject-segmentation", version.ref = "mlkitSubjectSegmentation" }