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

Image mirror automatically #3

Open
azzoor opened this issue Jul 7, 2013 · 0 comments
Open

Image mirror automatically #3

azzoor opened this issue Jul 7, 2013 · 0 comments

Comments

@azzoor
Copy link

azzoor commented Jul 7, 2013

Had to change the code below to include a Default in each switch in the UIImage+Resize.m file. iOS 6.1 the images would always appear as being mirrored after editing

  • (CGAffineTransform)transformForOrientation:(CGSize)newSize {
    CGAffineTransform transform = CGAffineTransformIdentity;

    switch (self.imageOrientation) {
    case UIImageOrientationDown: // EXIF = 3
    case UIImageOrientationDownMirrored: // EXIF = 4
    transform = CGAffineTransformTranslate(transform, newSize.width, newSize.height);
    transform = CGAffineTransformRotate(transform, M_PI);
    break;

    case UIImageOrientationLeft:           // EXIF = 6
    case UIImageOrientationLeftMirrored:   // EXIF = 5
        transform = CGAffineTransformTranslate(transform, newSize.width, 0);
        transform = CGAffineTransformRotate(transform, M_PI_2);
        break;
    
    case UIImageOrientationRight:          // EXIF = 8
    case UIImageOrientationRightMirrored:  // EXIF = 7
        transform = CGAffineTransformTranslate(transform, 0, newSize.height);
        transform = CGAffineTransformRotate(transform, -M_PI_2);
        break;
    default:
        break;
    

    }

    switch (self.imageOrientation) {
    case UIImageOrientationUpMirrored: // EXIF = 2
    case UIImageOrientationDownMirrored: // EXIF = 4
    transform = CGAffineTransformTranslate(transform, newSize.width, 0);
    transform = CGAffineTransformScale(transform, -1, 1);
    break;

    case UIImageOrientationLeftMirrored:   // EXIF = 5
    case UIImageOrientationRightMirrored:  // EXIF = 7
        transform = CGAffineTransformTranslate(transform, newSize.height, 0);
        transform = CGAffineTransformScale(transform, -1, 1);
        break;
    default:
        break;
    

    }

    return transform;
    }

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

No branches or pull requests

1 participant