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

createNonInterpolatedUIImageFromCIImage flips the image #4

Open
kauffmanelia opened this issue Oct 21, 2015 · 1 comment
Open

createNonInterpolatedUIImageFromCIImage flips the image #4

kauffmanelia opened this issue Oct 21, 2015 · 1 comment

Comments

@kauffmanelia
Copy link

I just started using this guide on how to generate QR codes for my app and it mostly works, but I notice that the -createNonInterpolatedUIImageFromCIImage method posted here actually flips the given image vertically. I verified this by comparing it to UIImage +imageWithCIImage, which gave me an interpolated image that was the right orientation. Adding a line
scaledImage = [UIImage imageWithCGImage:scaledImage.CGImage scale:1.0 orientation:UIImageOrientationDownMirrored];
into the end of the method flips it back to vertical.

@WingedToaster
Copy link

A better way of doing this is probably within the existing CGContext. Should add these 2 lines before CGContextDrawImage(context, CGContextGetClipBoundingBox(context), cgImage);

CGContextTranslateCTM(context, 0, size);
CGContextScaleCTM(context, 1.0, -1.0);

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

2 participants