ios - Merging multiple images into 1 -


I'm trying to overlay images taken from the camera with some other preset images. The problem is that the camera There may be 8MP, which is very large in the memory usage period. Nothing can be more than an overlay trying to cover the entire image.

I tried several ways to merge them all into one image.

  UIGraphicsBeginImageContextWithOptions (_imageView.image.size, 1.0F); [_containerView.layer renderInContext: UIGraphicsGetCurrentContext ()]; UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext ();   

or

  CGContextDrawImage (UIGraphicsGetCurrentContext (), (CGRect) {CGPointZero, _imageView.image.size}, _imageView.image.CGImage); CGContextDrawImage (UIGraphicsGetCurrentContext (), (CGRect) {CGPointZero, _imageView.image.size} * Other image views *);   

or UIImage * image = _imageView.image; CGImageRef imageRef = image.CGImage; Size_t imageWidth = (size_t) image.size.width; Size_t imageHeight = (size_t) image.size.height; CGContextRef Reference = CGBitMapContextCreate (NULL, CGImageGetWidth (imageRef), CGImageGetHeight (imageRef), CGImageGetBitsPerComponent (imageRef), CGImageGetBytesPerRow (imageRef), CGImageGetColorSpace (imageRef), CGImageGetBitmapInfo (imageRef)); CGRCR Rack = (CGRTAT) {CPanPanzero, {ImageWood, ImageHit}}; CGContextDrawImage (reference, rect, imageRef); CGContextDrawImage (Reference, Rect, ** Other Images **); CGImageRef newImageRef = CGBitmapContextCreateImage (reference); CGContextRelease (reference); UIImage * Result = Zero; NSURL * url = [NSU file file path: [Instrumentory directory (stringBapping path comparison: @ "X.JPG"]]; Seaflerfofflrf = CFBidingReturn (url); CGImageDestinationRef Destination = CGImageDestinationCreateWithURL (URLRef, KUTTypeJPEG, 1, NULL); If (destination! = Null) {CGImageDestinationAddImage (destination, new image, NULL); If (CGImageDestinationFinalize (destination)) {resultImage = [[UIImage alloc] initWithContentsOfFile: url.path]; } CFRelease (destination); } CGIJarrelies (newimagefrog);

All but essentially, the current memory usage doubles.

Is there anyway to compose them all together without the need for creating new references? Possibly save all the images in the file system and are actually merged without consuming memory? Or maybe even rendering in tile file system per tile?

Any suggestions or pointer where I go from this?

Thank you

See the following code You can send many images to the following methods, Although you are facing memory problems, I suggest you call the same method with duplication to merge multiple images. However this process may take longer.

  - (CGImageRef) Merged ImageForm image: (UIImage *) imageOne and image two: (UIImage *) imageTwo {NSAutoreleasePool * pool = [[NSAUTOriasius Alok] init]; CGSize imageSize = imageOne.size; UIGraphicsBeginImageContext (sizeVideo); [ImageOne DrawRectects: CGRactMake (0,0, Image Size. Width, Images, Height)]; [Image Two Drain Protected: CGRactMake (0,0, Image Size. Images, Images. Highlight) Alpha: 1]; CGImageRef imageRefNew = CGImageCreativeWithImageInRect (UIGraphicsGetImageFromCurrentImageContext (). CGImage, CGRectMake (0,0, imageOne.width, imageOne.height)); UIGraphicsEndImageContext (); [Bridge release]; Return image rfnew; }   

Hope this helps.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -