ciimage

Getting message in console: “CreateWrappedSurface() failed for a dataprovider-backed CGImageRef.”

Deadly 提交于 2019-12-04 11:29:45
问题 Updated to Xcode 7 and getting this (warning?) message while an image was being rendered in an operation: CreateWrappedSurface() failed for a dataprovider-backed CGImageRef. There was no message like this under Xcode 6.4. Got which code part threw the message: if (!self.originalImage) // @property (nonatomic, strong) UIImage *originalImage; return; CGImageRef originalCGImage = self.originalImage.CGImage; NSAssert(originalCGImage, @"Cannot get CGImage from original image"); CIImage

Creating transparent gradient and use it as an alpha-mask in SpriteKit

ぃ、小莉子 提交于 2019-12-04 10:56:24
I am trying to make a gradient and use it as an alpha mask. Right now, I am able to make an image similar to this (from black to transparent): This is the code which I use to make all this: private func createImage(width: CGFloat, height: CGFloat) -> CGImageRef?{ if let ciFilter = CIFilter(name: "CILinearGradient"){ let ciContext = CIContext() ciFilter.setDefaults() let startColor = CIColor(red: 0, green: 0, blue: 0, alpha: 0) let endColor = CIColor(red: 0, green: 0, blue: 0, alpha: 1) let startVector = CIVector(x: 0, y: height-10) let endVector = CIVector(x: 0, y: height-22) ciFilter.setValue

UIImage looses its orientation while converting it into CIImage, then into CGImage and back to UIImage

倖福魔咒の 提交于 2019-12-04 07:00:00
问题 I know there are tons of questions like this but their solutions don't work for me. NOTE: The image is downloaded from the Internet. It isn't taken from iPhone 's camera. I have a UIImage . To do some image processing operations I use Metal and present the image in a MTKView . So, I convert the image into a CIImage . After doing all the modifications to the image I convert it back into CGImage and then into UIImage and save it. As a result the saved image's orientation is wrong. I'm not sure

Applying metadata to image causes performChanges request to fail

限于喜欢 提交于 2019-12-03 15:04:02
问题 I am using PhotoKit to edit photos and I need to preserve the metadata from the original photo. To do so I save the metadata then provide it to the options parameter in CGImageDestinationAddImage . I am able to finalize it and write it to disk successfully, but when I call performChanges to commit the asset edit, it fails. If I instead provide nil for options it will succeed. What is going wrong here? asset.requestContentEditingInputWithOptions(options) { (input: PHContentEditingInput!, _) ->

iOS face detector orientation and setting of CIImage orientation

六眼飞鱼酱① 提交于 2019-12-03 08:54:16
EDIT found this code that helped with front camera images http://blog.logichigh.com/2008/06/05/uiimage-fix/ Hope others have had a similar issue and can help me out. Haven't found a solution yet. (It may seem a bit long but just a bunch of helper code) I'm using the ios face detector on images aquired from the camera (front and back) as well as images from the gallery (I'm using the UIImagePicker - for both image capture by camera and image selection from the gallery - not using avfoundation for taking pictures like in the squarecam demo) I am getting really messed up coordinates for the

Getting message in console: “CreateWrappedSurface() failed for a dataprovider-backed CGImageRef.”

对着背影说爱祢 提交于 2019-12-03 08:12:06
Updated to Xcode 7 and getting this (warning?) message while an image was being rendered in an operation: CreateWrappedSurface() failed for a dataprovider-backed CGImageRef. There was no message like this under Xcode 6.4. Got which code part threw the message: if (!self.originalImage) // @property (nonatomic, strong) UIImage *originalImage; return; CGImageRef originalCGImage = self.originalImage.CGImage; NSAssert(originalCGImage, @"Cannot get CGImage from original image"); CIImage *inputCoreImage = [CIImage imageWithCGImage:originalCGImage]; // this results the console message I replaced my

How to output a CIFilter to a Camera view?

浪子不回头ぞ 提交于 2019-12-03 03:08:30
I'm just starting out in Objective-C and I'm trying to create a simple app where it shows the camera view with a blur effect on it. I got the Camera output working with the AVFoundation framework. Now, I'm trying to hook up the Core image framework but to no knowledge how to, Apple documentation is confusing for me and searching for guides and tutorials online leads to no results. Thanks in advance for the help. #import "ViewController.h" #import <AVFoundation/AVFoundation.h> @interface ViewController () @property (strong ,nonatomic) CIContext *context; @end @implementation ViewController

Apply Black and White Filter to UIImage

柔情痞子 提交于 2019-12-02 22:33:09
I need to apply a black-and-white filter on a UIImage. I have a view in which there's a photo taken by the user, but I don't have any ideas on transforming the colors of the image. - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = NSLocalizedString(@"#Paint!", nil); imageView.image = image; } How can I do that? Objective C - (UIImage *)convertImageToGrayScale:(UIImage *)image { // Create image rectangle with current image width/height CGRect imageRect = CGRectMake(0, 0, image.size.width, image.size.height); // Grayscale color space CGColorSpaceRef colorSpace =

CGImage from NSURL works but not from UIImage

£可爱£侵袭症+ 提交于 2019-12-02 18:06:15
问题 I have some issues applying filters to an image. The following code works perfect when using CIImage:imageWithContentsOfURL: NSInteger filterIndex = [(UITapGestureRecognizer *)sender view].tag; Filter *filter = [filters objectAtIndex:filterIndex]; CIContext *context = [CIContext contextWithOptions:nil]; CIImage *image = [CIImage imageWithContentsOfURL:[NSURL URLWithString:@"http://url.to/photo.jpg"]]; [filter.filter setValue:image forKey:kCIInputImageKey]; CIImage *result = [filter.filter

Null passed to a callee that requires a non-null argument

时光总嘲笑我的痴心妄想 提交于 2019-12-02 00:30:57
问题 I have been using this to convert a CIImage to NSData for ages: NSData *data = [imageRep representationUsingType: NSPNGFileType properties:nil]; Now on El Capitan I have this error on the second line: Null passed to a callee that requires a non-null argument I can solve that by using an empty array on the properties, like this: NSData *data = [imageRep representationUsingType: NSPNGFileType properties: @{}]; but I am suspecting that this can cause me problems in the future. Is this the