def main():
    image = cv2.imread('test.jpg')
image = cv2.cvtColor(image, cv2.cv.CV_BGR2RGBA)
pix = Pix.from_rgba(image)
pix.save('test.png')
if __name__ == '__main__':
    main()
How to send file as stream from python to a C library