Import an Image to Photos
-
Description
POST /image_to_album HTTP/1.1
[image binary data] -
Possible Responses
{"code":0,"message":"Success"}
{"code":1,"message":"Operation failed"}
-
Desktop example (Python 3.x):
# -*- coding: utf-8 -*-
import http.client
import json
imgf = open('r:/1.png', 'rb') # image file path
imgdata = imgf.read()
conn = http.client.HTTPConnection("192.168.31.72:46952") # device address and port
conn.request("POST", "/image_to_album", imgdata)
response = conn.getresponse()
if response.status == 200:
ret = json.loads(response.read().decode('utf-8')) # explicitly decode as UTF-8
print(ret['message'])
else:
print(response.status, response.reason)
print(response.read().decode('utf-8')) # explicitly decode as UTF-8
conn.close() -
Notes
- Supported formats: PNG, JPG