1

How can I combine two images?

I mean I have two images: one small and another big one. I want to add small image onto big one at a specific point and I need to get an UIImage as the result.

I have tried CGCreateImageFromMask but that makes small image to cover bigger image completely.

Bobrovsky
  • 13,789
  • 19
  • 80
  • 130
  • Have a look at this question [stitch-picture-in-iphone](http://stackoverflow.com/questions/218388/stitch-picture-in-iphone) – Dan Dec 05 '08 at 08:19

1 Answers1

4

You'll want to use UIGraphicsBeginImageContext() to generate a CGContextRef, then use UIGraphicsGetCurrentContext() to get a reference to it.

Now draw your current images into the context. When you're done, use UIGraphicsGetImageFromCurrentContext() to generate an UIImage from that context, and UIGraphicsEndImageContext() to clean up.

See Apple's UIKit Function Reference doc.

Bobrovsky
  • 13,789
  • 19
  • 80
  • 130
Ben Gottlieb
  • 85,404
  • 22
  • 176
  • 172