Saving Numpy array to Image

To save Numpy array to image, you can use pypng package. It is completely written in python and doesn't require any dependencies. It requires python 3.4 or higher.

You can use pip  to install this package.

pip install pypng

You need to import png  in code to use it. Here is an example.

import png
png.from_array(arr, 'L').save("pic.png")

You can find its documentation here. => https://pypng.readthedocs.io/en/latest/

GitHub link. =>  https://github.com/drj11/pypng/

Comments

  1. Sir..first of all tell me what is numpy array and why we use numpy array because i don't know about Numpy Array...😦

    ReplyDelete

Post a Comment