Quantcast
Channel: WP快站
Viewing all articles
Browse latest Browse all 233

Encoding gif to base64 without writing to disk python

$
0
0

I am able to encode a gif to base64 by saving the data first.

    imageio.mimsave(output_fn, [img_as_ubyte(frame) for frame in gif], fps=original_fps)    with open(output_fn, "rb") as gif_file:            detect_base64 = 'data:image/gif;base64,{}'.format(base64.b64encode(gif_file.read()).decode())

I need to find a way to encode the gif above in the form an array of images, with the corresponding fps into base64 without the need of saving it into output_fn first.


Viewing all articles
Browse latest Browse all 233

Trending Articles