18 lines
457 B
Python
18 lines
457 B
Python
from PIL import Image
|
|
import sys
|
|
|
|
def main():
|
|
in_file = sys.argv[1]
|
|
new_width = int(sys.argv[2])
|
|
new_height = int(sys.argv[3])
|
|
dst_file = sys.argv[4]
|
|
with Image.open(in_file) as im:
|
|
dst = Image.new(im.mode, (new_width, new_height))
|
|
for y in range(im.height):
|
|
for x in range(im.width):
|
|
dst.putpixel((x, y), im.getpixel((x, y)))
|
|
dst.save(dst_file)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|