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

TransformationUtils.rotateImageExif may cause rotate all bitmaps, even it needn't rotation #270

Closed
darklee opened this issue Nov 18, 2014 · 1 comment
Labels
Milestone

Comments

@darklee
Copy link

darklee commented Nov 18, 2014

    /**
     * Rotate and/or flip the image to match the given exif orientation.
     *
     * @param toOrient The bitmap to rotate/flip.
     * @param pool A pool that may or may not contain an image of the necessary dimensions.
     * @param exifOrientation the exif orientation [1-8].
     * @return The rotated and/or flipped image or toOrient if no rotation or flip was necessary.
     */
    public static Bitmap rotateImageExif(Bitmap toOrient, BitmapPool pool, int exifOrientation) {
        if (exifOrientation == ExifInterface.ORIENTATION_NORMAL
                || exifOrientation == ExifInterface.ORIENTATION_UNDEFINED) {
            return toOrient;
        }

@param exifOrientation the exif orientation [1-8]. But the value of exifOrientation may be -1,because of new ImageHeaderParser( stream ).getOrientation()may be -1.
When the value is -1, the condition is no effect.

if (exifOrientation == ExifInterface.ORIENTATION_NORMAL
                || exifOrientation == ExifInterface.ORIENTATION_UNDEFINED) {
@darklee darklee closed this as completed Nov 18, 2014
@sjudd
Copy link
Collaborator

sjudd commented Nov 18, 2014

I imagine the reason you closed this is that initializeMatrixForRotation doesn't set a rotation for unrecognized values, so the end result is a Bitmap that is not yet rotated?

It's a reasonable point though that we should still be more efficient about doing nothing for orientations we generate. I think this is a legit report from an efficiency perspective if not correctness, thanks for filing the issue!

@sjudd sjudd reopened this Nov 18, 2014
@sjudd sjudd added the bug label Nov 18, 2014
@sjudd sjudd added this to the 3.5 milestone Nov 18, 2014
sjudd added a commit to sjudd/glide that referenced this issue Nov 20, 2014
@sjudd sjudd closed this as completed in 72e93e6 Nov 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants