Giter VIP home page Giter VIP logo

Comments (18)

ArthurHub avatar ArthurHub commented on July 19, 2024

Do you use setImageUriAsync(Uri) method to set the image? if so it will read the exif data automatically.
How Picasso is helping you?

from android-image-cropper.

qcdyx avatar qcdyx commented on July 19, 2024

Yes, I use mCropImageView.setImageUriAsync(Uri.parse(mUriStr)) to set the image. I guess It doesn't work because there's no ExifInfo available. To be honest, I never dig deeply into how Picasso works. But every time I use Picasso.with(context).load(uri).into(imageView), it will fix the problem automatically.

from android-image-cropper.

ArthurHub avatar ArthurHub commented on July 19, 2024

Without exif data I don't see how Picasso could "fix" it...
Can you upload an image taken from camera, maybe I don;t handle the exif data correctly..

from android-image-cropper.

qcdyx avatar qcdyx commented on July 19, 2024

1
2

from android-image-cropper.

ArthurHub avatar ArthurHub commented on July 19, 2024

I need the original image from camera, not screen capture, sorry I wan't clear

from android-image-cropper.

qcdyx avatar qcdyx commented on July 19, 2024

original1_cropping
original1
original2_cropping
original2

from android-image-cropper.

qcdyx avatar qcdyx commented on July 19, 2024

Hi again, sorry, I told you wrong information. In this case, orientation == ExifInterface.ORIENTATION_ROTATE_90. I tried rotateImage(bitmap, 90) but it doesn't work.
public static Bitmap rotateImage(Bitmap src, int degree) {
int w = src.getWidth();
int h = src.getHeight();

    Matrix mtx = new Matrix();
    mtx.postRotate(degree);
    Timber.e("degree: %d", degree);

    return Bitmap.createBitmap(src, 0, 0, w, h, mtx, true);
}

from android-image-cropper.

qcdyx avatar qcdyx commented on July 19, 2024

Hi again, do you have an idea where the bug could be? Maybe I can help as I need this library for a project that needs to be delivered soon. Thanks for letting me know.

from android-image-cropper.

ArthurHub avatar ArthurHub commented on July 19, 2024

I'm not sure as the images you uploaded are very confusing... the image with the coffee cup looks corrupted, half of it is white...
Lets help each other, I believe i will find the bug quickly when I get an image with the exif data. Unfortunately github changed the images, probably during the upload, can you upload them to this public one drive folder, thx.

p.s. you should not rotate the image manually, when using setImageUriAsync(Uri) it should just work, it reads the exif data and does the rotation internally.
Also it's not clear to me when you rotates the bitmap...

from android-image-cropper.

qcdyx avatar qcdyx commented on July 19, 2024

I rotate the image in onActivityResult before the app goes to the cropping screen. The images should be there. Thank you and keep me posted.

from android-image-cropper.

ArthurHub avatar ArthurHub commented on July 19, 2024

I don't get it... the images don't have exif data and are correctly oriented...
are you able to reproduce the issue in the library sample app?

from android-image-cropper.

qcdyx avatar qcdyx commented on July 19, 2024

Sorry for the delay. It takes me a while to get the sample run. It works for me. Any suggestions?

from android-image-cropper.

ArthurHub avatar ArthurHub commented on July 19, 2024

Ok... I'm 98% sure the library handles the images correctly.

We need to understand what your code does different than the sample.
See MainActivity.onActivityResult method, there is a bit of code to handle new permissions system but basically it calls mCurrentFragment.setImageUri(imageUri) that will set the image for cropping using mCropImageView.setImageUriAsync(imageUri).

imageUri is an Android reference URI instance that is retrieved from CropImageHelper.getPickImageResultUri(this, data) that has the logic to get the correct URI depending if the source is camera app of gallery app.

Note that it doesn't load the bitmap, or read the exif data at any point in the sample, all the work is done in setImageUriAsync(Uri) that is part of the library.

Now, what happens in your code?
If you can post it, that may help too.

from android-image-cropper.

qcdyx avatar qcdyx commented on July 19, 2024

I might know where goes wrong. In MainActivity.onActivityResult method, after the app gets mFileUri = CropImageHelper.getPickImageResultUri(this, data), it replaces the current fragment with a new fragment and displays the image in the new Fragment. Let me try something first and get back to you. Thank you.

from android-image-cropper.

qcdyx avatar qcdyx commented on July 19, 2024

Hi, it works now! Instead of replacing the current fragment with a new fragment, I create a pair of Activity and Fragment to display the image. I also use CropImageHelper.startPickImageActivity(this) instead of using my own methods.

from android-image-cropper.

ArthurHub avatar ArthurHub commented on July 19, 2024

Awesome! glad it worked out.

from android-image-cropper.

qcdyx avatar qcdyx commented on July 19, 2024

Thank you for this amazing library!

from android-image-cropper.

dhananjay23 avatar dhananjay23 commented on July 19, 2024

Hello Sir,
I am facing same problem for image capture in samsung device and image rotate automatically ,
i have check other device but image is set potrait format , i have use picasso library to resize the
image.

Pleaase provide me any suggestion and help for solve this problem !!!!!!

from android-image-cropper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.