fabian7593 / MagicalCamera

A library to take picture easy, transform your data in different format and save photos in your device
Apache License 2.0
338 stars 90 forks source link

Rotate picture #29

Closed Simston closed 7 years ago

Simston commented 7 years ago

Yes I can rotate the picture. But according to what? When I take a picture with the phone vertically the photo is turned 90 ° in the ImageView, have you planned something on this subject?

fabian7593 commented 7 years ago

Same issue, please see this url... https://github.com/fabian7593/MagicalCamera/issues/25

Simston commented 7 years ago

Ok thank you, I tried this for a good orientation in the ImageView automatically after taking a picture. It works, but do you think it is a good method? I'm new Developer and sorry for my bad English.

     //CALL THIS METHOD EVER
        magicalCamera.resultPhoto(requestCode, resultCode, data);

        //this is for rotate picture in this method
        String rec;
        StringBuilder builderInformation = new StringBuilder();
        if (magicalCamera.initImageInformation()) {
            if (Utils.notNullNotFill(magicalCamera.getPrivateInformation().getOrientation()))
                builderInformation.append(magicalCamera.getPrivateInformation().getOrientation());
        }
        rec = builderInformation.toString();
        if(Objects.equals(rec, "6")){
            magicalCamera.resultPhoto(requestCode, resultCode, data, MagicalCamera.ORIENTATION_ROTATE_90);
        }if(Objects.equals(rec, "8")){
            magicalCamera.resultPhoto(requestCode, resultCode, data, MagicalCamera.ORIENTATION_ROTATE_270);
        }if(Objects.equals(rec, "3")){
            magicalCamera.resultPhoto(requestCode, resultCode, data, MagicalCamera.ORIENTATION_ROTATE_180);
        }

mPhotoCapturedImageView.setImageBitmap(magicalCamera.getPhoto());`

fabian7593 commented 7 years ago

@Simston Relax with your English, mine is bad too...

My recommendation is not use private information because the orientation rotate is not always correct (I use Exif Interface to to create this piece of code, if you dont know ExifInterface please investigate a little about to the subject ), for the hardware problem that I write in this issue https://github.com/fabian7593/MagicalCamera/issues/25

Maybe exists a work around for see the device picture ever in protrait without use "ExifInterface", and no matter your brand or your hardware...

I commented this with another software enginners professionals and we don't known the solution in this moment :( ...

But if you get to know the solution please share with us for modify the library, or create a fork and push your changes...

Thanks for use magical camera

buelersandra commented 6 years ago

How do you get the initial orientation before rotatating magicalCamera.resultPhoto(requestCode, resultCode, data, rotation angle); to the right angle because setting a default will rotation even images with normal rotation.

magicalCamera.getPrivateInformation().getOrientation() returns null