mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
Simplified use of sys.argv
This commit is contained in:
parent
59b9d1dc46
commit
3c73043509
|
@ -286,7 +286,7 @@ Image.register_save(SpiderImageFile.format, _save_spider)
|
|||
|
||||
if __name__ == "__main__":
|
||||
|
||||
if not sys.argv[1:]:
|
||||
if len(sys.argv) < 2:
|
||||
print("Syntax: python SpiderImagePlugin.py [infile] [outfile]")
|
||||
sys.exit()
|
||||
|
||||
|
@ -295,10 +295,6 @@ if __name__ == "__main__":
|
|||
print("input image must be in Spider format")
|
||||
sys.exit()
|
||||
|
||||
outfile = ""
|
||||
if len(sys.argv[1:]) > 1:
|
||||
outfile = sys.argv[2]
|
||||
|
||||
im = Image.open(filename)
|
||||
print("image: " + str(im))
|
||||
print("format: " + str(im.format))
|
||||
|
@ -307,7 +303,9 @@ if __name__ == "__main__":
|
|||
print("max, min: ", end=' ')
|
||||
print(im.getextrema())
|
||||
|
||||
if outfile != "":
|
||||
if len(sys.argv) > 2:
|
||||
outfile = sys.argv[2]
|
||||
|
||||
# perform some image operation
|
||||
im = im.transpose(Image.FLIP_LEFT_RIGHT)
|
||||
print(
|
||||
|
|
Loading…
Reference in New Issue
Block a user