curl --location --request POST "https://api.imgbb.com/1/upload?key=YOUR_CLIENT_API_KEY" --form "image=R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
How to post an image in imgbb? I am beginner. I can not post any image.
url = 'https://api.imgbb.com/1/upload'
key = '232565fc1a4f0d24578d9aeadc0b43ab'
res = requests.post(
url,
data = {
'key': key,
'image':b64encode(open('a.png', 'rb').read()),
'name': 'a.png',
}
)
That is what worked for me.
import base64
import requests
with open("fig1.png", "rb") as file:
url = "https://api.imgbb.com/1/upload"
payload = {
"key": key_imgbb,
"image": base64.b64encode(file.read()),
}
res = requests.post(url, payload)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With