diff --git a/resize.py b/resize.py index ffd10ca..93f6862 100755 --- a/resize.py +++ b/resize.py @@ -19,6 +19,7 @@ infile = args.source outfile = args.destination try: im = Image.open(infile) + format = im.format im = im.convert() if args.width is not None or args.height is not None: if args.width is None: @@ -55,7 +56,7 @@ try: if args.enhance: enhancer = ImageEnhance.Contrast(im) im = enhancer.enhance(1.05) - im.save(outfile, "JPEG", quality=100) + im.save(outfile, format, quality=100) except IOError as e: print("cannot create thumbnail for '%s'" % infile) print "I/O error({0}): {1}".format(e.errno, e.strerror)