Skip to main content
theGreatAuk
Participant
May 13, 2014
Question

First Script: Need some basic skill help? Can you add an image with a click?

  • May 13, 2014
  • 2 replies
  • 232 views

Hello, Im working on a project were you can replace people heads in a photo. Its for a project so its not supposed to be perfect. So far heres what i think the best steps to take are, but im not sure how to take the first scripting steps. How can i add an image with a script? How can i store a x y coordinates?

  1. 1. I would create four variables and than store the XY cords of the the high point of the head, the bottom of the chin, amd the farthest right and left of the face.
  2. 2. I would than add the image of the head that I would already have.
  3. 3. If the x coordinates of the top and bottom are off kilter, I would rotate new head until = old face dimensions..
  4. 4. I would also see if the width is too big or small and resize accordingly
  5. 5. I would than resize the head so that the eyes would match up.

Thanks for any help you can provide!

This topic has been closed for replies.

2 replies

JJMack
Community Expert
Community Expert
May 14, 2014

Is that script for a browser html. Its not for Photoshop and like Photoshop would fine UiApp undefined so does Microsoft.  Is that a Chrome script or Android script? Why post it here?

Atiqur Sumon wrote:

function doGet() {
  
var app = UiApp.createApplication();
  
// The very first Google Doodle!
   app
.add(app.createImage("http://www.google.com/logos/googleburn.jpg"));
  
// Just the man in the middle
   app
.add(app.createImage("http://www.google.com/logos/googleburn.jpg", 118, 0, 50, 106));
  
return app;
}


JJMack
c.pfaffenbichler
Community Expert
Community Expert
May 14, 2014
1. I would create four variables and than store the XY cords of the the high point of the head, the bottom of the chin, amd the farthest right and left of the face.

How do you intend to declare those variables?

I personally think Paths would be a viable option.

2. I would than add the image of the head that I would already have.

In what form is the file available?

Could you post examples for both the original and the head images?