Picture Instruments


Image Processing API

API is designed to be used within various applications. Use form below to register in three simple steps or to re-send confirmation code or API key to your previously confirmed email. Please note API limits.
  • Enter your e-mail and hit Register button
  • Confirm email by clicking received link
  • Use API key sent to your email as X-Api-Key header to access API methods

Enter your email and hit Register

Methods

All methods require your API key set to X-Api-Key header

Process

Process image

URL: /api/process/
Method: POST (multipart/form-data)

Mandatory parameters
  • url or file - URL of an image as parameter or file
Optional parameters
  • remove_borders - if presented, borders should be removed
  • crop - if presented, image should be cropped and following parameters are mandatory
    • crop_top
    • crop_right
    • crop_bottom
    • crop_left
    • crop_unit (should be either px or %)
  • resize - if presented, image should be resized and following parameters are mandatory
    • resize_width
    • resize_height
Returns
  • result - processing_id string

Status

Check image processing status

URL: /api/status/<processing_id>/
Method: GET

Mandatory parameters
  • processing_id - ID that you have received after calling process
Returns
  • result - current processing status

Result

Get image processing result

URL: /api/result/<processing_id>/
Method: GET

Mandatory parameters
  • processing_id - ID that you have received after calling process
Returns
  • result - result JSON (see examples below)
Within response you will find fields called name which look like some-name.fmt, this is your images, they should be accessed via URL picinst.com/media/result/some-name.fmt for example picinst.com/media/result/3ca30a29783d11e6ba00e03f49d45688-f9dd45d4ba3843959b880c720a6b888b.png

Examples

Process URL

curl \
    -H "X-Api-Key: 53c538ec8d710-To11ytz7Fla6rSWonPRZ3TDAnIoYT6Tz" \
    -X POST \
    --form url=http://picinst.com/static/logo.png \
    --form remove_borders= \
    --form crop= \
    --form crop_top=1 \
    --form crop_right=1 \
    --form crop_bottom=1 \
    --form crop_left=1 \
    --form crop_unit=px \
    --form resize= \
    --form resize_width=10 \
    --form resize_height=10 \
    picinst.com/api/process/
{
    "result": "f55f2ea4-59f8-40fe-9fa1-e06f4e0c06ce",
    "status": "success"
}
curl \
    -H "X-Api-Key: 53c538ec8d710-To11ytz7Fla6rSWonPRZ3TDAnIoYT6Tz" \
    -X GET \
    picinst.com/api/status/f55f2ea4-59f8-40fe-9fa1-e06f4e0c06ce/
{
    "result": "finished",
    "status": "success"
}
curl \
    -H "X-Api-Key: 53c538ec8d710-To11ytz7Fla6rSWonPRZ3TDAnIoYT6Tz" \
    -X GET \
    picinst.com/api/result/f55f2ea4-59f8-40fe-9fa1-e06f4e0c06ce/
{
    "result": {
        "result": {
            "height": 34,
            "name": "553637d2791811e6bb91e03f49d45688-aaf2403d0ce14a5d846fff2875806f74.png",
            "mode": "RGBA",
            "gps": null,
            "origin": {
                "url": true,
                "source": "http://picinst.com/static/logo.png"
            },
            "has_borders": true,
            "datetime": null,
            "mode_description": "true color with transparency",
            "size": 419,
            "copyright": null,
            "frames": null,
            "format": "PNG",
            "animated": false,
            "width": 34,
            "borders": {
                "bottom": 8,
                "top": 8,
                "right": 7,
                "left": 0
            }
        },
        "processed": {
            "height": 10,
            "name": "553637d3791811e6bb91e03f49d45688-0dbdfad970c44e0cb1b87ecb8ad0cd87.png",
            "mode": "RGBA",
            "gps": null,
            "origin": null,
            "has_borders": null,
            "datetime": null,
            "mode_description": "true color with transparency",
            "size": 191,
            "copyright": null,
            "frames": null,
            "format": "PNG",
            "animated": false,
            "width": 10,
            "borders": null
        }
    },
    "status": "success"
}

Process file

curl \
    -H "X-Api-Key: 53c538ec8d710-To11ytz7Fla6rSWonPRZ3TDAnIoYT6Tz" \
    -X POST \
    --form file=@logo.png \
    --form remove_borders= \
    --form crop= \
    --form crop_top=1 \
    --form crop_right=1 \
    --form crop_bottom=1 \
    --form crop_left=1 \
    --form crop_unit=px \
    --form resize= \
    --form resize_width=10 \
    --form resize_height=10 \
    picinst.com/api/process/
{
    "result": "7fcba4dd-d2ef-4c7e-b4d5-2da6289c96cb",
    "status": "success"
}
curl \
    -H "X-Api-Key: 53c538ec8d710-To11ytz7Fla6rSWonPRZ3TDAnIoYT6Tz" \
    -X GET \
    picinst.com/api/status/7fcba4dd-d2ef-4c7e-b4d5-2da6289c96cb/
{
    "result": "finished",
    "status": "success"
}
curl \
    -H "X-Api-Key: 53c538ec8d710-To11ytz7Fla6rSWonPRZ3TDAnIoYT6Tz" \
    -X GET \
    picinst.com/api/result/7fcba4dd-d2ef-4c7e-b4d5-2da6289c96cb/
{
    "result": {
        "result": {
            "height": 34,
            "name": "e46f24b8791811e6bb91e03f49d45688-174c2899b588487f87969f71d8aa303a.png",
            "mode": "RGBA",
            "gps": null,
            "origin": {
                "url": false,
                "source": "logo.png"
            },
            "has_borders": true,
            "datetime": null,
            "mode_description": "true color with transparency",
            "size": 419,
            "copyright": null,
            "frames": null,
            "format": "PNG",
            "animated": false,
            "width": 34,
            "borders": {
                "bottom": 8,
                "top": 8,
                "right": 7,
                "left": 7
            }
        },
        "processed": {
            "height": 10,
            "name": "e46f24b9791811e6bb91e03f49d45688-2939c1c2cd724c49b952cf411eabd543.png",
            "mode": "RGBA",
            "gps": null,
            "origin": null,
            "has_borders": null,
            "datetime": null,
            "mode_description": "true color with transparency",
            "size": 191,
            "copyright": null,
            "frames": null,
            "format": "PNG",
            "animated": false,
            "width": 10,
            "borders": null
        }
    }, 
    "status": "success"
}