# @Author  : lightXu
# @File    : img_urlcode.py
import base64


def img2base64(img):
    base64_data = base64.b64encode(img)
    print(base64_data)
    return base64_data


if __name__ == '__main__':
    img_path = r'C:\Users\Administrator\Desktop\history\0002.jpg'
    with open(img_path, 'rb') as f:
        img2base64(f.read())
