Web service to overlay pictures?

Discussion in 'Technology' started by Daniel from Montréal, Jan 20, 2011.

  1. Daniel from Montréal Member

    Member Since:
    Aug 4, 2000
    Location:
    Montréal
    Club:
    Montreal Impact
    Country:
    Canada
    I'm working on a project and we'd like to have people be able to upload pictures of themselves and overlay them within certain predefined frames (ie clown, cowboy, hockey player).

    Does anyone have an idea how we would/should go about doing this?

    Thanks!
          
  2. spejic Cautionary example

    Member Since:
    Mar 1, 1999
    Location:
    San Rafael, CA
    Club:
    San Jose Earthquakes
    You still need help with this? Since you know you need a web service, this is simply a programming exercise dealing with two images. Most any means of creating the web service can be done with libraries that let you load and manipulate bitmaps easily enough - I know you can do it in .NET using the System.Drawing namespace. Size both images so they are the same. Assuming the person is being photographed at a greeen screen (or some other flat monochrome background), just take a sample of the upper corner of the person image and for every pixel in the person image that is reasonably close to that color, change it to the equivalent pixel in the background image.

    You will have to experiment to see what kind of range of background pixels you need to replace. And using this simple method you will probably have some fake-looking fringing around the person. There are techniques for dealing with that, but now you are getting into more complicated image processing.
  3. Alan S Member

    Member Since:
    Jun 1, 2001
    Location:
    Palo Alto, CA
    Club:
    San Jose Earthquakes
    Country:
    United States
    Web service to overlay pictures? try new HTML5 canvas tag.

    If you don't care about the IE browser, the new HTML spec from the W3C - called HTML5 has a useful canvas tag. If you know a javascript and don't care about Microsoft this might be an interesting way to do it.

    Below are some links.

    https://developer.mozilla.org/en/canvas_tutorial

    http://thinkvitamin.com/code/how-to-draw-with-html-5-canvas/

    http://www.w3schools.com/html5/tag_canvas.asp

    http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html
  4. laasan Member

    Member Since:
    Apr 12, 2010
    if you are using php, it couldn´t be easier: http://www.php.net/manual/en/function.imagecopymerge.php

    just make sure the frame is in png format, with transparent background.

Share This Page