Edit

Edit image - Upload target image

Upload an image either by providing a local file or a URL.

Example:


import requests
import json

url_api = 'https://api.piktid.com/api'

# Option 1: Upload local file
target_full_path = 'local_path_of_your_target_image'
options = {}

response = requests.post(url_api+'/edit/target',
headers={'Authorization': 'Bearer '+TOKEN},
files={'file': open(target_full_path, 'rb')},
data={'options':json.dumps(options)},
)

# Option 2: Provide image URL
image_url = 'https://example.com/image.jpg'
response = requests.post(url_api+'/edit/target',
headers={'Authorization': 'Bearer '+TOKEN},
data={
'url': image_url,
'options': json.dumps(options)
},
)

response_json = json.loads(response.text)
id_image = response_json.get('id_image')
num_persons = response_json.get('num_persons')
coordinates_list = response_json.get('coordinates_list')
mask_links = response_json.get('mask_links')
POST
/api/edit/target
AuthorizationBearer <token>

In: header

file?string
url?string
options?string

Response Body

Examples

curl -X POST "https://api.piktid.com/api/edit/target"
{
  "id_image": "string",
  "num_persons": 0,
  "coordinates_list": [
    {
      "id": 0,
      "centerX": 0,
      "centerY": 0,
      "cornerX": 0,
      "cornerY": 0,
      "boxWidth": 0,
      "boxHeight": 0
    }
  ],
  "mask_links": [
    {
      "f": "string",
      "l": "string",
      "t": "string"
    }
  ]
}
{
  "code": 0,
  "message": "string",
  "description": "string"
}
{
  "code": 0,
  "message": "string",
  "description": "string"
}
{
  "code": 0,
  "message": "string",
  "description": "string"
}