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

Fix: Use "rwt" file mode for the output image file #926

Open
wants to merge 2 commits into
base: develop-non-native
Choose a base branch
from

Conversation

AdamGrzybkowski
Copy link

@AdamGrzybkowski AdamGrzybkowski commented Aug 27, 2024

Closes #546

This PR fixes an issue with the output file size. No matter how low the compression quality is set the image will remain its original file size after cropping.

The default file mode used when opening the OutputStream for the mImageOutputUri seems to be the culprit. Changing it to wt fixed the issue.

Testing:

Use the sample app and first check the develop-non-native branch.

  1. Use Tmp file destination
  2. Select Resize image to max size - set it to a low value like 500
  3. Set compression quality to 20
  4. Tap pick & crop
  5. Use JPEG
  6. Select an image (big one ideally)
  7. Crop the image
  8. Once finished use the Device Explorer in Android Studio and go to data/data/com.yalantis.ucrop.sample/cache
  9. Check the size of the file SampleCropImage.jpg - compare it with the original

Now check out this branch and repeat the steps above.

@AdamGrzybkowski
Copy link
Author

@lynnik It looks like you are one of the maintainers now - can you take a look at this one?

@AdamGrzybkowski AdamGrzybkowski changed the title Use file mode for the output image file Fix: Use "wt" file mode for the output image file Sep 2, 2024
@maxme
Copy link

maxme commented Sep 4, 2024

Hey @lynnik, this is kind of blocking for us and we'll probably have to fork and manage our own release of uCrop if we want to continue working with it. Obviously this is not something we would like to do.

Let us know (@AdamGrzybkowski , @hamorillo and @maxme) if you need help with the project and publishing updates, maybe we can help.

@vladlynnik
Copy link

Hey, @AdamGrzybkowski, thanks for reaching out! We’re currently working on it and will provide an update soon. We'll keep you in the loop.

jens-muenker added a commit to jens-muenker/uCrop-n-Edit that referenced this pull request Sep 15, 2024
@jens-muenker
Copy link

I made today a non-native version of my fork and included your bugfix. Maybe that might help you :)

@AdamGrzybkowski AdamGrzybkowski changed the title Fix: Use "wt" file mode for the output image file Fix: Use "rwt" file mode for the output image file Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants