Mugshot (Just slightly better than alpha)

Mugshot is a web service which provides simple face-detection in images. It is an experiment making use of libface and node.js. A simple API allows clients to upload or provide a URL for an image file. Mugshot will detect faces and provide co-ordinates or allow a browser-based view highlighting the faces.

Mugshot is an experiment. It was inspired by OpenKeyVal. It does not provide a permanent image hosting service like Flickr or Picasa. It is liable to go down or be shut off at any point. Do not expect that your images will be around for-ever or that they are privacy protected. So please make sure you think twice before trying it on an image. I will of course NOT sell or distribute your images in any manner, but nothing is stopping others from browsing through images by ID.

Who is behind Mugshot?

Mugshot is created by Nikhil Marathe using a thin V8 binding he has written to libface. All code is open source and available on GitHub. Contact: nsm.nikhil@gmail.com

API

Mugshot allows either file uploads or providing a URL to a remote image file. API access is of course langauge and platform specific. cURL examples are provided.

Constraints

Images are restricted to a maximum of 5Mb in size. They will also be deleted whenever disk space is low in order of least recently uploaded.

Response

All replies are formatted as JSON literals. The status attribute will be either "success" or "error". If "success", the reply will be:

    {
        "status": "success",
        "id": "<id>",
        "image_url": "http://mugshotapp.com:8080/image/<unique_image_file>",
        "share_url": "http://mugshotapp.com:8080/view/<id>",
        "faces": [{
                    "x": 5,
                    "y": 5,
                    "width": 30,
                    "height": 30
                  },
                  ...]
    }
    

image_url provides the image directly, while share_url has JavaScript and CSS which highlights the faces and is a good way to view in the browser. faces is an array of objects, each having the co-ordinates of one face. It may be empty, if no faces are detected. In case of an error:

    {
        "status": "error",
        "message": "error message"
    }
    

In addition, the HTTP status code will depend on the result.

File uploads

Make a POST request to http://mugshotapp.com:8080/file with the request body being the image data.


    curl http://mugshotapp.com:8080/file --data-binary @/path/to/image/file.ext
    

URL

Make a POST request to http://mugshotapp.com:8080/url with the request body being the URL where the image can be found.


    curl http://mugshotapp.com:8080/url --data "http://url/toimage"
    

Thanks to

Swair Shah and Aditya Bhatt for pointing out edge case bugs.