🌐
BytesToBits API Documentation
  • Introduction
  • Basic API Usage
  • Image Endpoints
Powered by GitBook
On this page

Image Endpoints

GET https://api.bytestobits.dev/v1/image/mask

Mask an image.

Headers

Name
Type
Description

Authorization*

String

Your API Key

Request Body

Name
Type
Description

image*

File

Image to mask

mask*

File

Black-white image to use as mask

Example
import requests

IMAGE_PATH = "image.png"
MASK_PATH = "mask.png"
API_KEY = "YOUR_API_KEY"

response = requests.get("https://api.bytestobits.dev/v1/image/mask", headers={ "Authorization": f"Bearer {API_KEY}" }, files={
    "image": open(IMAGE_PATH, "rb"),
    "mask": open(MASK_PATH, "rb")
})

with open("out.png", "wb+") as f:
    f.write(response.content)

GET https://api.bytestobits.dev/v1/image/recolor

Swap the color of an image with another.

Headers

Name
Type
Description

Authorization*

String

Your API Key

Request Body

Name
Type
Description

image*

File

Image to recolor

from_color*

String

The hex color to replace

to_color*

String

The replacing color hex

strength

Integer

The similar-shaded colors to include (Defaults: 20)

Example
import requests

IMAGE_PATH = "image.png"
API_KEY = "YOUR_API_KEY"

response = requests.get("https://api.bytestobits.dev/v1/image/recolor?from_color=000000&to_color=ffffff&strength=32", headers={ "Authorization": f"Bearer {API_KEY}" }, files={
    "image": open(IMAGE_PATH, "rb")
})

with open("out.png", "wb+") as f:
    f.write(response.content)

GET https://api.bytestobits.dev/v1/image/resize

Resize an image.

Headers

Name
Type
Description

Authorization*

String

Your API Key

Request Body

Name
Type
Description

image*

File

Image to resize

width*

Integer

New image width

height*

Integer

New image height

Example
import requests

IMAGE_PATH = "image.png"
API_KEY = "YOUR_API_KEY"

response = requests.get("https://api.bytestobits.dev/v1/image/width?width=1200&height=800", headers={ "Authorization": f"Bearer {API_KEY}" }, files={
    "image": open(IMAGE_PATH, "rb")
})

with open("out.png", "wb+") as f:
    f.write(response.content)

GET https://api.bytestobits.dev/v1/image/transparent

Remove a color from an image.

Headers

Name
Type
Description

Authorization*

String

Your API Key

Request Body

Name
Type
Description

image*

File

Image to resize

color*

String

The color hex to make transparent

strength

Integer

The similar-shaded colors to include (Defaults: 20)

Example
import requests

IMAGE_PATH = "image.png"
API_KEY = "YOUR_API_KEY"

response = requests.get("https://api.bytestobits.dev/v1/image/transparent?color=ff0000&strength=15", headers={ "Authorization": f"Bearer {API_KEY}" }, files={
    "image": open(IMAGE_PATH, "rb")
})

with open("out.png", "wb+") as f:
    f.write(response.content)

GET https://api.bytestobits.dev/v1/image/discord_faker

Generate a fake discord message.

Headers

Name
Type
Description

Authorization*

String

Your API Key

Request Body

Name
Type
Description

username*

String

Username to use

text*

String

Content of the message

avatar

File

Avatar of the user

user_color*

String

Color hex for the username

date*

String

Date to use (such as Today at 03:52 PM)

Example
import requests

AVATAR_PATH = "avatar.png"
API_KEY = "YOUR_API_KEY"

response = requests.get("https://api.bytestobits.dev/v1/image/discord_faker?username=Nemika&text=Hello&user_color=eccfee&date=Today+at+02%3A32+PM", headers={ "Authorization": f"Bearer {API_KEY}" }, files={
    "avatar": open(AVATAR_PATH, "rb")
})

with open("out.png", "wb+") as f:
    f.write(response.content)

GET https://api.bytestobits.dev/v1/image/dominant

Get the dominant color of an image.

Headers

Name
Type
Description

Authorization*

String

Your API Key

Request Body

Name
Type
Description

image*

File

Image to get the dominant color of

Example
import requests

IMAGE_PATH = "image.png"
API_KEY = "YOUR_API_KEY"

response = requests.get("https://api.bytestobits.dev/v1/image/dominant", headers={ "Authorization": f"Bearer {API_KEY}" }, files={
    "image": open(IMAGE_PATH, "rb")
})

print(response.json())

Image Filters

GET https://api.bytestobits.dev/v1/image/filter/blackwhite

Turn an image into black and white.

Headers

Name
Type
Description

Authorization*

String

Your API Key

Request Body

Name
Type
Description

image*

File

Image to remove the color from

Example
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)

GET https://api.bytestobits.dev/v1/image/filter/enhance

Enhance an image.

Headers

Name
Type
Description

Authorization*

String

Your API Key

Request Body

Name
Type
Description

image*

File

Image to enhance

color

Float

Value to increase the intensity of the image colors (Defaults: 0)

brightness

Float

Value to increase the brightness of the image (Defaults: 0)

sharpness

Float

Value to increase the sharpness of the image colors (Defaults: 0)

contrast

Float

Value to increase the contrast of the image (Defaults: 0)

Example
import requests

IMAGE_PATH = "image.png"
API_KEY = "YOUR_API_KEY"

response = requests.get("https://api.bytestobits.dev/v1/image/filter/enhance?color=1.2", headers={ "Authorization": f"Bearer {API_KEY}" }, files={
    "image": open(IMAGE_PATH, "rb")
})

with open("out.png", "wb+") as f:
    f.write(response.content)

GET https://api.bytestobits.dev/v1/image/filter/hueshift

Hueshift an image.

Headers

Name
Type
Description

Authorization*

String

Your API Key

Request Body

Name
Type
Description

image*

File

Image to enhance

deg

Float

Degrees to rotate the hue of the image (Defaults: 20)

Example
import requests

IMAGE_PATH = "image.png"
API_KEY = "YOUR_API_KEY"

response = requests.get("https://api.bytestobits.dev/v1/image/filter/hueshift?deg=182", headers={ "Authorization": f"Bearer {API_KEY}" }, files={
    "image": open(IMAGE_PATH, "rb")
})

with open("out.png", "wb+") as f:
    f.write(response.content)
PreviousBasic API Usage

Last updated 1 year ago