Page MenuHomePhabricator

[GSoC Proposal] Implement Lossless JPEG Transformations and Privacy Blur to the Commons Android App
Closed, DeclinedPublic

Description

Lossless JPG Editing for Wikimedia Commons Android: Precise Crop, Rotation, and Privacy-Aware Blurring

Name: Jagadeeshwar Reddy Kota
Email: kota.jagadesh123@gmail.com
GitHub: https://github.com/kota-jagadeesh
LinkedIn: https://linkedin.com/in/jagadeeshwar-reddy-kota
Country: India
Preferred Time Zone: Indian Standard Time (IST, UTC +5:30)
University: Amrita Vishwa Vidyapeetham
Course: Bachelor of Technology in Artificial Intelligence & Data Science
Availability for Google Summer of Code: Full-time (42+ hours per week)

Synopsis

App

Wikimedia Commons is an Android application developed by the Wikimedia Foundation that enables users to browse, upload, and contribute media directly to the Wikimedia Commons repository using their mobile devices. Users can easily select images from their device gallery or capture photos using the camera and upload them to the platform. The app aims to simplify the media contribution workflow and make it easier for contributors to share freely licensed images with the Wikimedia ecosystem.

Project

This project aims to implement advanced lossless JPEG image editing capabilities in the Wikimedia Commons Android App to enable contributors to safely edit images before uploading them, while preserving their original quality, metadata, and file structure. While the application already supports basic editing features such as cropping and rotation, these operations need to be improved to ensure that transformations remain fully lossless and do not alter the image data, metadata, or color information.

Through my prior investigation of Issue #6659, I conducted detailed testing on the current rotation pipeline, including multi-step rotation experiments and metadata comparisons using tools such as exiftool. My prior work on Issue #6659 revealed that Android’s native metadata handling strips ICC color profiles during rotation. This project will bypass the native API and use jpegtran to ensure fully lossless transformations with complete metadata preservation.. Because the color profile is lost, image viewers render the rotated image with a different gamma/brightness profile. Based on this investigation, the project will focus on implementing a rotation pipeline that bypasses this metadata rewriting behavior using jpegtran to preserve the original headers and maintain exact color fidelity.

A key design principle of this project is that all transformations should operate directly on the JPEG macroblock structure, ensuring that edits are performed without unnecessary loss of information and without increasing the file size. This approach guarantees that contributors can safely edit images inside the app without degrading their quality or altering their metadata.

To achieve this, the project will deliver the following core improvements:

  • Deliverable 1: 100% Lossless Crop & Rotate (Fixing Issue #6659) The existing crop and rotation features will be improved to guarantee fully lossless transformations. The rotation pipeline will be redesigned to preserve the complete JPEG metadata, including the ICC color profile, preventing brightness and gamma shifts. This involve bypassing Android’s ExifInterface metadata rewriting and using a lower-level JPEG transformation approach (using jpegtran) that keeps the original metadata headers intact.
  • Deliverable 2: Automated Privacy Detection (Issue #1192) To assist contributors in protecting privacy before uploading images, the project will integrate on-device computer vision using OpenCV's Deep Neural Network (DNN) module. OpenCV is a widely used open-source computer vision library that supports modern deep learning, based object detection while operating entirely offline.

    Using OpenCV’s DNN module, the application will run lightweight pre-trained detection models to identify sensitive regions such as human faces and vehicle license plates. These models analyze the image and return bounding box coordinates for detected objects with high accuracy. Because the detection pipeline runs fully on-device, no images are transmitted to external services, ensuring strict privacy preservation and compliance with Wikimedia’s privacy requirements. The detected bounding boxes will be presented within the editing interface and passed to the lossless image editing module. These coordinates will then be used to determine the corresponding JPEG macroblocks that must be modified during the lossless blurring stage.
  • Deliverable 3: Lossless Macroblock Blurring (Issue #190) The project will implement lossless privacy-aware blurring by modifying only the specific JPEG 8×8 DCT macroblocks corresponding to detected sensitive regions (faces or license plates). Instead of recompressing the entire image, which would degrade quality and potentially increase file size, this approach manipulates only the relevant macroblocks while leaving the rest of the JPEG structure untouched. As a result, the final image retains its exact original quality, metadata, and file size while ensuring that sensitive regions are irreversibly blurred.

By integrating these capabilities directly into the Commons Android App, contributors will be able to perform essential edits, such as cropping, rotating, and privacy blurring, directly within the application before uploading media. This reduces reliance on third-party editing tools, prevents accidental image degradation, and lowers the barrier for mobile contributions to Wikimedia Commons.

Issue Links

Possible Mentor(s)

Have you contacted the mentors already?
Yes

Technical Approach

Image Processing Pipeline-2026-03-20-101814.png (1,240×5,580 px, 384 KB)

Figure: Pipeline for lossless JPEG editing and privacy-aware transformations

The project will use a pipeline that combines lossless JPEG processing with on-device computer vision:

  • Lossless transformations (crop, rotate, blur) will be performed using jpegtran
  • A JNI bridge will enable interaction between the Android (Kotlin) layer and the native jpegtran library
  • OpenCV DNN will be used to detect faces and license plates directly on-device
  • Detected regions will be mapped to JPEG macroblocks for precise modifications
  • All processing will occur locally on-device, ensuring privacy and no data transmission

Implementation Plan

This project will introduce a robust lossless image editing pipeline for the Wikimedia Commons Android App by improving the current editing workflow and integrating reliable mechanisms for metadata preservation, privacy detection, and macroblock-level image manipulation. The implementation will be structured into four main technical components.

1. Lossless Crop and Rotation Pipeline (Fixing Issue #6659)

The first component focuses on ensuring that existing editing operations such as rotation and cropping remain fully lossless while preserving all metadata, including the ICC color profile.

As identified during the investigation of Issue #6659, the current rotation pipeline relies on Android’s ExifInterface.saveAttributes() method, which rewrites the EXIF metadata block and removes the original ICC color profile.

To resolve this issue, the project will implement a lossless JPEG transformation pipeline using jpegtran, a widely used tool for performing lossless operations directly on JPEG files. Unlike standard image editing methods that decode and recompress the image, jpegtran operates directly on the JPEG compression structure, allowing transformations such as rotation and cropping to occur:
Since jpegtran is a native C library, integration will be achieved using the Android NDK and JNI (Java Native Interface). A lightweight JNI bridge will be implemented to enable communication between the Kotlin-based application layer and the native jpegtran library.

  • without recompression
  • without metadata loss
  • without increasing the file size

Updated pipeline steps:

  1. The selected image is passed to the editing module before upload.
  2. Instead of using Android’s metadata rewriting methods, the transformation is performed using jpegtran.
  3. jpegtran executes the requested transformation (crop or rotate) directly on the JPEG compression structure.
  4. The original metadata headers - including EXIF information and ICC color profiles - remain intact.

This approach ensures that the edited image retains exactly the same visual quality, metadata integrity, and file size as the original image.

2. Automated Privacy Detection using OpenCV (Fixing Issue #1192)

To assist contributors in protecting privacy before uploading images, the project will integrate on-device computer vision using OpenCV to automatically detect sensitive regions such as human faces and vehicle license plates.

OpenCV will be integrated to perform image analysis locally on the device. Since all processing occurs on-device, no image data is transmitted externally, ensuring strict privacy protection.

Detection pipeline steps:

  • The selected image is decoded into a Bitmap representation for computer vision analysis and then converted to an OpenCV Mat object for processing.
  • Face detection is implemented using the OpenCV DNN (Deep Neural Network) module, enabling the application to run pretrained lightweight deep learning models optimized for object detection.
  • A pretrained face detection model (such as an SSD or MobileNet-based detector) is loaded through the OpenCV DNN framework and used to analyze the image and identify human faces with associated confidence scores.
  • For vehicle license plate detection, a lightweight object detection model is used within the same OpenCV DNN pipeline to identify rectangular plate regions.
  • The detection model returns bounding box coordinates corresponding to the detected sensitive regions.

These detected bounding box coordinates are then passed to the image editing module, where the lossless macroblock-based blurring system applies privacy-aware blur only to the relevant JPEG regions while leaving the rest of the image unchanged.
To prevent APK size increase due to OpenCV integration, only the required DNN modules will be included, and Android ABI splits (armeabi-v7a, arm64-v8a) will be used so that users download only the necessary native libraries for their device.

3. Lossless Macroblock-Based Privacy Blurring (Fixing Issue #190)

After detecting sensitive regions, the project will implement lossless privacy-aware blurring by modifying only the relevant JPEG compression blocks rather than recompressing the entire image.

JPEG images are internally represented using 8×8 Discrete Cosine Transform (DCT) blocks. Instead of decoding the entire image and recompressing it after applying blur, the project will operate directly on these compression blocks.

Process steps:

  1. The bounding box coordinates obtained from the OpenCV detection module are mapped to the corresponding JPEG block grid. Bounding boxes will be aligned to JPEG macroblock boundaries to ensure safe and consistent lossless transformations.
  2. The JPEG blocks intersecting the sensitive region are identified.
  3. Using jpegtran, only the selected macroblocks are manipulated to introduce irreversible blur in those regions.
  4. The remaining image blocks remain unchanged.

Because this process operates directly on the JPEG compression structure, the resulting image maintains:

  • identical visual quality outside the blurred region
  • original metadata and headers
  • no increase in file size
  • no additional compression artifacts

4. Integration with the Commons Upload Workflow

The final step integrates the new editing pipeline into the existing image editing workflow of the Commons Android App.
Users will be able to adjust detected regions using draggable bounding boxes or manually select regions, which will be mapped to the nearest JPEG macroblocks for precise lossless blurring.

Updated editing flow:

  1. User selects or captures an image.
  2. The user optionally opens the Edit Image interface.
  3. Privacy detection is executed using OpenCV.
  4. Detected sensitive regions are highlighted for user confirmation or adjustment.
  5. The user can apply cropping, rotation, or privacy blur.
  6. The requested transformations are executed using the lossless jpegtran pipeline.
  7. The processed image is passed to the existing upload module.

This integration ensures that contributors can safely perform essential image edits directly within the application before uploading their media to Wikimedia Commons.

Through this architecture, the project will provide a reliable lossless image editing system that preserves metadata integrity, protects user privacy, and ensures that transformations occur without unnecessary recompression or increase in file size.

Timeline

Note : During May 20 - June 3, my university end-semester examinations will take place. While this overlaps slightly with the early coding period, I will remain active in the project and the community. As I am already familiar with the Commons Android App and the contributor workflow, I plan to begin preliminary implementation during the community bonding period while also participating in discussions and reviewing existing pull requests where possible. Although development progress may be slightly slower during examination days, I will continue contributing consistently and will ensure that any limited progress during this period is compensated once the exams conclude.

TimeframeStart DateEnd DateTasks and Subtasks
Community Bonding PeriodMay 1, 2026May 24, 2026Get familiar with mentors and the Wikimedia developer community. Study the Commons Android App architecture, image editing pipeline, and relevant modules. Review documentation related to JPEG compression, metadata handling, and jpegtran. Set up the development environment and finalize the implementation plan with mentors.
Week 1May 25, 2026May 31, 2026Set up lossless JPEG transformation environment
SubtaskMay 25, 2026May 27, 2026Integrate jpegtran using Android NDK and implement JNI bridge for native interaction.
SubtaskMay 28, 2026May 31, 2026Study the current image editing workflow and identify integration points for the new lossless transformation pipeline.
Week 2June 1, 2026June 7, 2026Implement base lossless rotation pipeline
SubtaskJune 1, 2026June 4, 2026Implement JPEG rotation using jpegtran and validate rotation correctness.
SubtaskJune 5, 2026June 7, 2026Verify metadata preservation and confirm ICC profile retention using tools such as exiftool.
Week 3June 8, 2026June 14, 2026Fix metadata loss issue Fixes Issue #6659
SubtaskJune 8, 2026June 11, 2026Redesign the rotation pipeline to bypass Android ExifInterface.saveAttributes() metadata rewriting.
SubtaskJune 12, 2026June 14, 2026Verify preservation of ICC color profiles and confirm brightness/gamma consistency after rotation.
Week 4June 15, 2026June 21, 2026Implement lossless cropping functionality
SubtaskJune 15, 2026June 18, 2026Implement cropping using jpegtran lossless transformations.
SubtaskJune 19, 2026June 21, 2026Validate cropped images to ensure metadata integrity and no quality loss.
Week 5June 22, 2026June 28, 2026Integrate lossless editing pipeline into the app UI
SubtaskJune 22, 2026June 25, 2026Connect the jpegtran transformation pipeline with the existing image editing interface.
SubtaskJune 26, 2026June 28, 2026Test rotation and cropping features within the complete upload workflow.
Week 6June 29, 2026July 5, 2026Integrate OpenCV environment for privacy detection
SubtaskJune 29, 2026July 2, 2026Integrate OpenCV into the Android project and configure the image processing pipeline.
SubtaskJuly 3, 2026July 5, 2026Convert Android Bitmap images to OpenCV Mat format and prepare preprocessing steps.
Week 7 (Midterm milestone)July 6, 2026July 12, 2026Implement face detection using OpenCV DNN
SubtaskJuly 6, 2026July 9, 2026Integrate pretrained DNN face detection model within OpenCV.
SubtaskJuly 10, 2026July 12, 2026Generate bounding box coordinates for detected faces and verify detection accuracy.
Week 8July 13, 2026July 19, 2026Implement license plate detection
SubtaskJuly 13, 2026July 16, 2026Integrate object detection model for license plate detection using OpenCV DNN.
SubtaskJuly 17, 2026July 19, 2026Refine bounding box filtering and improve detection reliability.
Week 9July 20, 2026July 26, 2026Develop macroblock-based blur algorithm
SubtaskJuly 20, 2026July 23, 2026Map detection bounding boxes to the JPEG 8×8 macroblock grid.
SubtaskJuly 24, 2026July 26, 2026Implement algorithm to modify only the relevant JPEG macroblocks.
Week 10July 27, 2026August 2, 2026Integrate privacy-aware blur into the editing workflow
SubtaskJuly 27, 2026July 30, 2026Apply macroblock-based blur to detected sensitive regions.
SubtaskJuly 31, 2026August 2, 2026Add manual adjustment option for users to refine blur regions if automatic detection fails.
Week 11August 3, 2026August 9, 2026Testing and performance optimization
SubtaskAugust 3, 2026August 6, 2026Optimize OpenCV detection performance and editing pipeline.
SubtaskAugust 7, 2026August 9, 2026Add unit tests and integration tests for editing features.
Week 12August 10, 2026August 16, 2026Final integration and project completion
SubtaskAugust 10, 2026August 13, 2026Perform final bug fixes, UI improvements, and code cleanup.
SubtaskAugust 14, 2026August 16, 2026Prepare final documentation, developer guidelines, and final project report.

This timeline is flexible and will be refined in consultation with mentors based on project progress and feedback.

Benefits to the Community

This project will enhance the image editing capabilities of the Commons Android App by enabling truly lossless transformations, ensuring that images retain their original quality, metadata, and file size.

While the app already supports basic editing features such as cropping and rotation, these operations are not fully lossless. As a result, images may undergo recompression, leading to quality degradation, loss of metadata (such as EXIF and ICC profiles), and potential changes in file size. Additionally, the lack of built-in privacy-aware blurring forces contributors to rely on third-party tools, which further increases the risk of information loss.

By implementing a lossless editing pipeline using jpegtran and introducing privacy-aware blurring, this project will allow contributors to safely edit images directly within the app without compromising their integrity.

Overall, this project will:

  • Preserve image quality and metadata during editing
  • Eliminate unnecessary recompression and file size changes
  • Introduce built-in privacy protection features
  • Reduce dependency on external tools
  • Improve the overall mobile contribution workflow

These improvements will lower barriers to contribution and help increase both the quality and reliability of media uploaded to Wikimedia Commons.

About Me

I am Jagadeeshwar Reddy Kota, a second-year undergraduate student pursuing a Bachelor of Technology in Artificial Intelligence and Data Science at Amrita Vishwa Vidyapeetham, Amritapuri. I am an active member of amFOSS and part of the Road to Wikimedia Cohort 2, where I have been consistently contributing to open-source projects.

I am primarily interested in Android development, web development, and machine learning. I have been working on Android development for over two years and have gained hands-on experience in building applications, debugging real-world issues, and improving user experience. I enjoy working on problems that require both system-level understanding and practical implementation.

I have built several projects across different domains:

Worked on a few more projects across Android, web, and machine learning domains.

My work also extends into reinforcement learning and system design, where I explored trajectory optimization using Proximal Policy Optimization (PPO) for robotic control.

I have actively participated in the open-source and research community, including:

Through my contributions to the Commons Android App, I have developed a strong understanding of the codebase, particularly in areas related to image handling and editing workflows. I enjoy collaborating with the community, reviewing pull requests, and working towards clean and maintainable solutions.

I am motivated by building efficient, real-world systems and continuously improving my technical skills through practical development and open-source contributions.

Availability

Eligible for Google Summer of Code and Outreachy?
I am eligible for Google Summer of Code and am applying only for GSoC.

Do you plan to submit any other proposal apart from this one?
Yes, I have also submitted another proposal (T420841)

Do you have any other plans this summer?
No, I do not have any internships or other commitments during the GSoC period. I will have end-semester examinations from May 20 to June 5; however, I will remain active during this period by participating in discussions, reviewing pull requests, and making incremental progress. After the exams, I will fully dedicate my time to the project. Google Summer of Code is my top priority this summer.

How many hours per week can you dedicate to this project?
I will dedicate a minimum of 42+ hours per week to this project and am willing to invest additional time if required to meet project goals.

Have you been accepted to GSoC before?
No, this is my first time applying for Google Summer of Code.

Previous Contributions

To date, I have submitted 50 pull requests, of which 38 have been merged and 10 are currently under review.

Merged Pull Requests (38)

The following table lists my 38 merged pull requests to the Commons Android App repository, showcasing contributions across bug fixes, UI/UX improvements, feature enhancements, testing, documentation, and repository maintenance.

S.NoPR #TitleStatus
01#6642Fix: Incorrect rotation logic and re-edit bugMerged
02#6565Fix: Preserve UploadActivity state across screen resizeMerged
03#6655Fix: Prevent ActivityLauncher crash by moving registration onCreateMerged
04#6661UninitialisedPropertyAccessException ImageFragment onDestroyMerged
05#6479Fix: Explore map crashes when tapped recenter buttonMerged
06#6429Fix: App crashes theme change multi uploadMerged
07#6775Fix: Reset upload state & UI fragments on new external share intentMerged
08#6694Fix: Improve UX for Edit image button on the non-JPEG filesMerged
09#6653Fix: Hide edit image button for unsupported non-JPEG filesMerged
10#6425Fix: location Permission prompt on Upload via mobile screenMerged
11#6420Fix: Add listener call in ImageAdapter to update UI & uploadMerged
12#6520Fix: bottom nav visibility media detailsMerged
13#6405Make “File Usages” items clickable with correct URLsMerged
14#6417Added wiki prefix to titles in GlobalFileUsageMerged
15#6637Feat: Link to actual profile when using custom author nameMerged
16#6738Feat: Enhance license selection with Expanding Cards & simplified choicesMerged
17#6578Feature: increase maximum zoom level on upload preview screenMerged
18#6557Enhance custom selector upload limitMerged
19#6709Fix: image sorting in custom selector to use historical orderOpen
20#6625Humanize github actions and prevent duplicate commentsMerged
21#6644Fix: Add assignment confirmation comment and fix new contributor welcome logicMerged
22#6632Fix: Refine auto assignment logicMerged
23#6635Fix: Refine assignment logic with issue contextMerged
24#6367Fix email verification inputMerged
25#6604Fix: missing accessibility for back button in singlewebviewactivityMerged
26#6529Test: Add campaigns api testsMerged
27#6363Update bug report to use type:bugMerged
28#6569Update feature request to use type:featureMerged
29#6698Docs: fix the broken linkMerged
30#0066Add link to commons mobile talk page for the app feedbackMerged
31#0065Document the additional features of the app in the docs sectionMerged
32#0063Add the commons policy and guidelines links to help new contributorsMerged
33#0060Fix: the broken link of imagesMerged
34#0003Docs: Update maintenance ReadmeMerged
35#0054Better documentation for the leaderboardMerged
36#0057Update link to unassigned bugs in documentationMerged
37#0002Add issue migration scriptMerged
38#0059Migrated from label:enhancement to type:featureMerged

Pull Requests Under Review (10)

S.NoPRTitleStatus
01#6532Fix: Prevent crash when pausing/resuming uploads after screen rotationOpen
02#6579Fix: Prevent crash in offline search caused by null map boundariesOpen
03#6602Refactor: Centralize location service unavailability handlingOpen
04#6605Fix: stateless in searchActivity and media detail pager fragment during screen rotationOpen
05#6613Fix: prevent UI settings on logoutOpen
06#6623Add unit tests for findUniqueFileNameOpen
07#6580Feature: Animated multi FAB upload in Pending UploadsOpen
08#6698Enforce upload limit in first step of upload FlowOpen
09#6649Automate issue assignment and implement inactivity managementDraft

Why Me / Motivation

This project strongly aligns with my interest in building efficient and reliable systems, especially in areas involving image processing, performance, and data integrity. The challenge of implementing truly lossless JPEG transformations while preserving metadata and ensuring privacy makes this problem both technically deep and highly impactful.

My prior contributions to the Commons Android App, particularly my work on image editing and Issue #6659, have given me a solid understanding of the existing pipeline and its limitations. Through debugging and experimentation, I have already explored the challenges of metadata preservation and lossless transformations, which allows me to approach this project with practical insight.

I am comfortable working with Android development, and I actively contribute to open source by fixing issues, reviewing pull requests, and collaborating with the community. I prioritize writing clean, maintainable code and communicating effectively with mentors.

With my prior experience, familiarity with the codebase, and strong commitment to this project, I am confident in delivering a robust and well-tested solution that meaningfully improves the Commons Android App.

Event Timeline

I will be updating this task from time to time.

VoidRaven-18 renamed this task from [GSoC Proposal] Add Lossless JPEG Transformations and Privacy Blur to the Commons Android App to [GSoC Proposal] Implement Lossless JPEG Transformations and Privacy Blur to the Commons Android App.Mar 15 2026, 8:38 PM
VoidRaven-18 updated the task description. (Show Details)

@Nicolas_Raoul @RitikaPahwa4444 @Kaartic
I’ve completed the first draft of my GSoC proposal and could you take a look whenever you have time. and give me feedback, suggestions, or areas where I can improve - whether it’s technical clarity, structure, or anything I might have missed. I’m actively working to refine it further and make it as as a strong as possible before submission.
also, if anyone else from the community has suggestions or feedback, I’d be more than happy to hear them. I’m always open to learning and improving.
Thanks a lot for your time and support! 🙂

Hi, thanks for submitting your GSoC 2026 project proposal with Wikimedia!

Please make sure you’ve also submitted your proposal on the official Summer of Code website: https://summerofcode.withgoogle.com. The deadline for both submission and any edits is the same, so ensure everything is finalized before March 31, 18:00 UTC, as changes won’t be possible after that.

We strongly recommend completing any updates at least 30 minutes before the deadline to avoid last-minute glitches or unexpected technical issues.

Wishing you all the best for your application. Hope to see you as part of the program soon! 🚀

Hi, thank you for your submission and the effort you put into your proposal. This year we received over 380 strong applications, and unfortunately we were not able to offer you a slot. This was a very competitive process, and many high quality proposals could not be selected. We truly encourage you to stay engaged and continue contributing to Wikimedia projects. Over the years, many contributors who were not selected for Google Summer of Code have gone on to make impactful contributions and become long term members of the community. Please do not see this as a failure, but as a step forward in your journey. We would love to stay in touch and support your continued involvement.

If you would like guidance on how to contribute to our projects outside GSoC, feel free to reach out to any of the mentors or org admins, they will be happy to help you get started.

You can get started or continue contributing here:

We hope to see your contributions in our community soon.

No worries, @Gopavasanth i'll try again next year. Until then, I'll keep focusing on improving myself and moving forward 🙂