Take photo with overlay

You must Login before you can answer or comment on any questions.

Hello everybody,

I want a simple thing, I guess... Take a picture with a png as overlay, and save it. In both, Android and iPhone!

Which is the best way to do that?

What I found:

//app.js
var cameraoverlay = Titanium.UI.createImageView({
    width: '480dp',
    height: '320dp',
    top:0,
    image:'images/pig.png'
});
 
Ti.Media.showCamera({
    overlay: cameraoverlay
});
The camera is working and the image is showing over the camera, but in this case, the autofocus doesn't work and the controls to take a picture and change the camera to back or front doesn't show. (Android Galaxy Nexus)

PS: I want to merge the overlay (pig.png) with the picture!

I'm using the last version of SDK and Titanium!

Thanks!

2 Answers

First, once you add an overlay, you are specifying the controls yourself, the overlay takes the place of the controls. So you can either do without the controls, or add the controls with your overlay. Second, to get the overlay with the image you can either take the photo, then composite the overlay onto the image in a new view, or you can try to just take a screenshot with the overlay up over the camera picture. Not sure if that second option will work or not, I've never tried it, but it sounds good in theory. The downside to that would be that you won't get full camera resolution out of your photo, you'll just get the screen resolution image.

— answered 9 months ago by Anthony Decena
answer permalink
5 Comments
  • I'll take a look for that, than post the results! Thank You

    — commented 9 months ago by Bruno Almeida

  • I tried, but I didn't found the command to join the images. And when I took a photo, the resolution is always 240x320px and the autofocus doesn't work!

    — commented 9 months ago by Bruno Almeida

  • There is no command to join images, you'd have to do it yourself. Create a view with the image as the background, then add the overlay to the view, then you'd have to export the view with toImage().

    As I said, if you did screenshots, you'd only get the resolution of the screen, it looks like that might be the case regardless.

    Your only other option here is to see if there is a module on the marketplace that can do what you need it to do.

    — commented 9 months ago by Anthony Decena

  • Show 2 more comments

Your Answer

Think you can help? Login to answer this question!