[LABI] tema07 parts 1 and 2 done
This commit is contained in:
parent
c1eaea544c
commit
d8fe986dcd
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 284 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 284 KiB |
|
@ -0,0 +1,22 @@
|
|||
from PIL import Image, ExifTags
|
||||
import sys
|
||||
|
||||
|
||||
def main(fname):
|
||||
img = Image.open(fname)
|
||||
|
||||
width, height = img.size
|
||||
|
||||
print("Width: %dpx" % width)
|
||||
print("Height: %dpx" % height)
|
||||
print("Format: %s" % img.format)
|
||||
|
||||
tags = img._getexif()
|
||||
|
||||
for tag, value in tags.items():
|
||||
decoded = ExifTags.TAGS.get(tag, tag)
|
||||
print("%s: %s" % (decoded, value))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1])
|
|
@ -0,0 +1,18 @@
|
|||
from PIL import Image, ExifTags
|
||||
import sys
|
||||
|
||||
|
||||
def main(file):
|
||||
img = Image.open(file)
|
||||
fname = '.'.join(file.split(".")[:-1]), file.split(".")[-1]
|
||||
|
||||
width, height = img.size
|
||||
|
||||
for s in [0.2, 8]:
|
||||
dimension = (int(width * s), int(height * s))
|
||||
new_img = img.resize(dimension, Image.NEAREST)
|
||||
new_img.save(fname[0]+"-%.2f.%s" % (s, fname[1]))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1])
|
Loading…
Reference in New Issue