open and save
In [1]:
!del Sharbat_Gula2.jpg
!dir Sharbat*
Volume in drive H is Google Drive
Volume Serial Number is 1983-1116
Directory of H:\My Drive\0001_projects\2024\AI_Python\16_Images
20/10/2024 16:48 37,655 Sharbat_Gula.jpg
1 File(s) 37,655 bytes
0 Dir(s) 67,373,584,384 bytes free
In [2]:
import imageio.v2 as imageio
import numpy as np
import matplotlib.pyplot as plt
def plot_image_from_array(image_array, title='Image'):
plt.imshow(image_array, cmap='gray')
plt.axis('off') # Hide axes
plt.title(title)
plt.show()
image = imageio.imread('Sharbat_Gula.jpg')
print("Image shape:", image.shape)
plot_image_from_array(image)
Image shape: (400, 254, 3)
In [3]:
imageio.imwrite('Sharbat_Gula2.jpg', image)
In [4]:
!dir Sharbat*
Volume in drive H is Google Drive
Volume Serial Number is 1983-1116
Directory of H:\My Drive\0001_projects\2024\AI_Python\16_Images
20/10/2024 16:48 37,655 Sharbat_Gula.jpg
21/10/2024 14:33 16,235 Sharbat_Gula2.jpg
2 File(s) 53,890 bytes
0 Dir(s) 67,373,522,944 bytes free
