Let's see how you can use our API to manipulate images. All the listed examples are made in Python.
# Let's call the index of the API to get the version.
import requests
response = requests.get("https://api.bytestobits.dev/v1/")
print(response.json())
{
"version": "alpha-0.0.1",
"title": "BytesToBits API",
"description": "The Official BytesToBits API"
}
Great. Now, let's make a request to turn an image black and white. To begin, put an image in the same directory as your code.
import requests
IMAGE_PATH = "image.png"
API_KEY = "YOUR_API_KEY"
response = requests.get("https://api.bytestobits.dev/v1/image/filter/blackwhite", headers={ "Authorization": f"Bearer {API_KEY}" }, files={
"image": open(IMAGE_PATH, "rb")
})
with open("out.png", "wb+") as f:
f.write(response.content)