1. <i id='ttcNI'><tr id='ttcNI'><dt id='ttcNI'><q id='ttcNI'><span id='ttcNI'><b id='ttcNI'><form id='ttcNI'><ins id='ttcNI'></ins><ul id='ttcNI'></ul><sub id='ttcNI'></sub></form><legend id='ttcNI'></legend><bdo id='ttcNI'><pre id='ttcNI'><center id='ttcNI'></center></pre></bdo></b><th id='ttcNI'></th></span></q></dt></tr></i><div id='ttcNI'><tfoot id='ttcNI'></tfoot><dl id='ttcNI'><fieldset id='ttcNI'></fieldset></dl></div>

      <legend id='ttcNI'><style id='ttcNI'><dir id='ttcNI'><q id='ttcNI'></q></dir></style></legend>
      <tfoot id='ttcNI'></tfoot>
        <bdo id='ttcNI'></bdo><ul id='ttcNI'></ul>

        <small id='ttcNI'></small><noframes id='ttcNI'>

      1. 使用 CoreImage 过滤图像会导致图像旋转

        时间:2023-05-31
      2. <small id='caAgc'></small><noframes id='caAgc'>

      3. <legend id='caAgc'><style id='caAgc'><dir id='caAgc'><q id='caAgc'></q></dir></style></legend>

              <bdo id='caAgc'></bdo><ul id='caAgc'></ul>
              <i id='caAgc'><tr id='caAgc'><dt id='caAgc'><q id='caAgc'><span id='caAgc'><b id='caAgc'><form id='caAgc'><ins id='caAgc'></ins><ul id='caAgc'></ul><sub id='caAgc'></sub></form><legend id='caAgc'></legend><bdo id='caAgc'><pre id='caAgc'><center id='caAgc'></center></pre></bdo></b><th id='caAgc'></th></span></q></dt></tr></i><div id='caAgc'><tfoot id='caAgc'></tfoot><dl id='caAgc'><fieldset id='caAgc'></fieldset></dl></div>
                <tbody id='caAgc'></tbody>

                  <tfoot id='caAgc'></tfoot>
                  本文介绍了使用 CoreImage 过滤图像会导致图像旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  感谢阅读.

                  我正在尝试在 iOS 5 中使用 CoreImage 来更改图像的外观.问题是现有图像在此过程中似乎丢失了其方向信息并最终旋转了 90 度.

                  I'm trying to use CoreImage in iOS 5 to alter the appearance of an image. The problem is that the existing image appears to lose its orientation information during the process and ends up rotated by 90 degrees.

                  代码如下:

                  CIContext *context = [CIContext contextWithOptions:nil];
                  CIImage *img = [CIImage imageWithCGImage:imageView.image.CGImage];
                  CIFilter *adjustFilter = [CIFilter filterWithName:@"CIHighlightShadowAdjust"];
                  
                  [adjustFilter setDefaults];
                  [adjustFilter setValue:img forKey:kCIInputImageKey];
                  [adjustFilter setValue:[NSNumber numberWithFloat:0.3] forKey:@"inputShadowAmount"];
                  CIImage *adjustedImage = [adjustFilter valueForKey:kCIOutputImageKey];
                  UIImage *newPtImage = [UIImage imageWithCGImage:[context adjustedImage fromRect:adjustedImage.extent]];
                  
                  imageView.image = newPtImage;
                  

                  原始图像通常来自相机拍摄的图像,但并非总是如此.

                  The original image generally comes from one taken by the camera, but not always.

                  希望有人能提供帮助.

                  罗伯.

                  推荐答案

                  其实我的问题的解决方案很简单.由于 CGImage 失去了它的方向和比例因子,我只需要添加

                  Actually, the solution to my issue turned out to be quite simple. Since the CGImage loses its orientation and scale factors, I simply needed to add

                  UIImageOrientation originalOrientation = imageView.image.imageOrientation;
                  CGFloat originalScale = imageView.image.scale;
                  

                  在代码的早期,然后用这个代替 [UIImage imageWithCGImage:]

                  early in the code and then used this instead of [UIImage imageWithCGImage:]

                      UIImage *newPtImage = [UIImage imageWithCGImage:img2 scale:originalScale orientation:originalOrientation];
                  

                  也感谢您的建议.

                  这篇关于使用 CoreImage 过滤图像会导致图像旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:iOS5 TabBar 字体和颜色 下一篇:iOS 中的访问设置应用程序

                  相关文章

                  最新文章

                  <small id='bIvtJ'></small><noframes id='bIvtJ'>

                    <legend id='bIvtJ'><style id='bIvtJ'><dir id='bIvtJ'><q id='bIvtJ'></q></dir></style></legend>

                  1. <tfoot id='bIvtJ'></tfoot>

                      • <bdo id='bIvtJ'></bdo><ul id='bIvtJ'></ul>
                      <i id='bIvtJ'><tr id='bIvtJ'><dt id='bIvtJ'><q id='bIvtJ'><span id='bIvtJ'><b id='bIvtJ'><form id='bIvtJ'><ins id='bIvtJ'></ins><ul id='bIvtJ'></ul><sub id='bIvtJ'></sub></form><legend id='bIvtJ'></legend><bdo id='bIvtJ'><pre id='bIvtJ'><center id='bIvtJ'></center></pre></bdo></b><th id='bIvtJ'></th></span></q></dt></tr></i><div id='bIvtJ'><tfoot id='bIvtJ'></tfoot><dl id='bIvtJ'><fieldset id='bIvtJ'></fieldset></dl></div>