GPUImage icon indicating copy to clipboard operation
GPUImage copied to clipboard

Fatal Exception: NSInternalInconsistencyException NSInternalInconsistencyException Passed image must not be empty - it should be at least 1px tall and wide

Open kissfro opened this issue 12 years ago • 4 comments

In some of my crash logs to Crashlytics I get:

Fatal Exception: NSInternalInconsistencyException NSInternalInconsistencyException Passed image must not be empty - it should be at least 1px tall and wide

and it happens on this line:

-[GPUImagePicture initWithImage:smoothlyScaleOutput:]

This is after a user either selects a photo from the photo library or take a picture with the camera and I try to convert it to a GPUImagePicture. Are people really trying to pass an image that's 1 px tall and wide (which is hard for me to believe) or is it possible something else is causing this?

kissfro avatar Jan 07 '14 12:01 kissfro

That exception is from the following lines of code in -initWithCGImage: smoothlyScaleOutput:, within GPUImagePicture:

// If passed an empty image reference, CGContextDrawImage will fail in future versions of the SDK.
NSAssert( widthOfImage > 0 && heightOfImage > 0, @"Passed image must not be empty - it should be at least 1px tall and wide");

Most likely, somehow you're passing a nil image or one that's completely empty in some way. The nil image is most likely, so check to make sure that the UIImage you're providing to GPUImagePicture exists before you initialize it with this. The exception fails at that point, because a 0-width or nil image will cause very odd crashes later on, and this exception makes it clear what's wrong.

BradLarson avatar Jan 07 '14 15:01 BradLarson

Yeah it just seems like there is some odd thing that is happening that is causing a photo that a user selects from their photo library to be blank. Anyways, I'll have to handle that case where the image is being returned nil. Thanks.

kissfro avatar Jan 08 '14 14:01 kissfro

I updated my code to not allow images less than 1 by 1 and I still seem to be getting this error. Not going to reopen this because I'm sure it's probably some mistake I'm making, I wonder if the problem could stem from 64 bit devices running the not updated build (I'm still running the GPUImage from September though I updated for my next release which isn't out yet).

kissfro avatar Mar 16 '14 23:03 kissfro

I am applying filter inside the VideoCompstion Request block on every frame..

the line has failed to Assert: sepiaFilter.image(byFilteringImage: image)

Below is code.: let vidComp = AVMutableVideoComposition(asset: playerItem!.asset, applyingCIFiltersWithHandler: { request in var image = UIImage(ciImage: request.sourceImage.clampingToExtent()) // Modify Image (image) Here... let sepiaFilter = GPUImageSepiaFilter() let image_filtered = sepiaFilter.image(byFilteringImage: image).ciImage

                                                request.finish(with: image_filtered!, context:context)

a2zZuhaib avatar Feb 13 '17 11:02 a2zZuhaib