<jupyter_start><jupyter_text>[View in Colaboratory](https://colab.research.google.com/github/gmihaila/snippets_py/blob/master/numpy_to_image.ipynb)  Numpy to Image Save and print.<jupyter_code>import numpy as np
from PIL import Image
from matplotlib import pyplot as plt


array = np.zeros([100, 200, 3], dtype=np.uint8)

array[:,:100] = [255, 128, 0] #Orange left side

array[:,100:] = [0, 0, 255]   #Blue right side

image = Image.fromarray(array)

# plot the image
graph = plt.imshow(image)
plt.grid(False)
plt.show()

# save image
image.save("test.PNG")
!ls<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14213197969543148, 'fraction_numerical': 0.043993231810490696, 'mean_word_length': 5.434782608695652, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '72705', 'license': 'MIT', 'n_tokens_mistral': 254, 'n_tokens_neox': 229, 'n_words': 54, 'path': 'python/jupyter_snippets/numpy_to_image.ipynb', 'repo_name': 'laviniaflorentina/unt_hpc', 'size': '591'}