I'm looking for a way to merge multiple images (jpeg/png) into one.
To get an idea, examples of iPhoen apps that can use this are:
- watermarking a photo
- generating an avatar with different portrait components: hair, nose, eyes etc…
Is there a way to do this? Using an external lib like ImageMagick for example?
I haven't tested this yet, but I think it should be possible to put the images in a window or view, and then do a toImage() on that. I'd say that would be faster than doing this online.
Perhaps you could layer the images (assuming they're PNG's) in your app until the user is ready to have them merged, then call an external PHP to do the work?
I don't know of a JS library could do this, but even if there were it might be expensive to do that from the client since memory and CPU is rather limited on the pre-3GS iPhones. You'd have a bit of a delay while you wait for the upload, merge, and download to be complete, but still may be faster. Plus if you find bugs with the merging you could fix them on the server right away without having to release a patch.
These links might help:
Ah, right, toImage. Forgot about that one. Might be worth a shot.
Thanks guys for your answers.
Both are making sense.
@Dan, your solution was the one I had in mind if I couldn't make it in app. The external PHP already exists but using it will make it necessary to have an internet connection in order to use the app.
So currently the best answer is from Martijn, although I can't test it right now. Thanks for pointing to this function.
Anyone has a sample code ?
Hello, anyone has an example of this, I do the same but not how.