-
Notifications
You must be signed in to change notification settings - Fork 2
/
set1q1.py
26 lines (26 loc) · 682 Bytes
/
set1q1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
import matplotlib.pyplot as plt
import imageio
image = imageio.imread('cameraman.tif')
plt.figure()
plt.subplot(121)
plt.imshow(image,cmap='gray')
plt.title('Original Image')
plt.xticks([]), plt.yticks([])
statinfo=os.stat('cameraman.tif')
a=statinfo.st_size
imageio.imsave('new1.jpg',image)
newimage=imageio.imread('new1.jpg')
plt.subplot(122)
plt.imshow(newimage,cmap='gray')
plt.xticks([]), plt.yticks([])
plt.title('Copied Image')
plt.show()
print('Image Information')
print ('Image Shape',newimage.shape)
print ('Image Size',newimage.size)
print ('Image Datatype',newimage.dtype)
statinfo=os.stat('new1.jpg')
b=statinfo.st_size
cr=a/b
print ('Compression ratio',cr)