Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Kotlin Multiplatform (KMP) package of jpegtran (lossless JPEG transformations) #5386

Open
nicolas-raoul opened this issue Nov 14, 2023 · 11 comments

Comments

@nicolas-raoul
Copy link
Member

jpegtran is a library for lossless JPEG transformations, available mostly as C source code. We want to use it to implement lossless crop and other lossless transforms.

However, the app must still be easily buildable by newcomers who just have a basic Android Studio (and thus can't compile C code).

The goal of this issue is to build (or find if by chance one is already available) a package based on Kotlin Multiplatform technology embedding jpegtran, and offering JPEG transformations that can be used from a Kotlin Android app. Please create a different GitHub project for this task. Any volunteer? Thanks! :-)

Tagged "good first issue" not because it is easy, but because no knowledge of Commons is needed.

@psh
Copy link
Collaborator

psh commented Nov 14, 2023

Kotlin multiplatform will let you pull the C code in and make it accessible to Kotlin/Native but I am pretty sure you will still need to use JNI and the Android NDK if you want to access the code from the main Android source-set. That said, you should be able to create a project and provide an AAR that the rest of the app can use if you configure things as a library project.

@nicolas-raoul
Copy link
Member Author

@psh

The idea would be to have a separate GitHub project whose goal is to produce a library that offers these transformations.

Our Commons app would only import that library (like any other external library, presumably through build.gradle) and use the methods. Hopefully building the Commons would just require Android Studio.

Does that sound like a good plan? 🙂

@psh
Copy link
Collaborator

psh commented Nov 15, 2023

The separate AAR library published as a maven/gradle dependency would definitely be easy to use & transparent to the casual developer of the commons app. 👍

@shashankiitbhu
Copy link
Contributor

Can I take on this issue? @nicolas-raoul could you assign it to me?

@nicolas-raoul
Copy link
Member Author

@shashankiitbhu It is yours!
Please let us know about your progress once per week or so, thanks a lot! 🙂

@shashankiitbhu
Copy link
Contributor

Hi @nicolas-raoul I am having difficulty with implementing jpegtran library in KMP , also there isn't any android or KMP library already available for this. However, there is a library in java for lossless JPEG transformations - https://github.com/k3b/LosslessJpgCrop/tree/master

@nicolas-raoul
Copy link
Member Author

@shashankiitbhu I am familiar with the project you linked to, but I am not sure whether the underlying Facebook Spectrum library can be used to implement near-lossless blurring.

@shankarpriyank What do you think? 🙂

@shankarpriyank
Copy link
Contributor

Had a quick glance, could not find anything related to blurring in the Spectrum library.
But on the good side, I was struggling a bit with the crop feature and I am pretty sure that I am gonna get all the help I needed from this project

@nicolas-raoul
Copy link
Member Author

@shankarpriyank

If Spectrum has a method to losslessly merge several JPEGs, then we can use it.

Please note that k3b's app is licensed under GPL, so we can't copy its code to our Apache-licensed app.

@shankarpriyank
Copy link
Contributor

@nicolas-raoul

If Spectrum has a method to losslessly merge several JPEGs, then we can use it.

Sorry, I did not get it.

Please note that k3b's app is licensed under GPL, so we can't copy its code to our Apache-licensed app.

Yup, What I meant to say was that, k3b is a nice application which has a cropping feature, and cause it's open-source, I can take inspiration from its code to implement the cropping feature in the commons app. Some parts of the code may be quite similar but I guess that wont be an issue.

@nicolas-raoul
Copy link
Member Author

@shashankiitbhu I unassign for now, but if you are you still working on this, please let us know. If no answer, someone else may be assigned to it. Thanks a lot. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants