contrib/png-it: allow saving to stdout with -
Following the same convention as some other tools, - as output filename means stdout now.
This commit is contained in:
@@ -45,9 +45,10 @@ def main():
|
|||||||
parser.error("You cannot specify --center or --crop with --autocrop.")
|
parser.error("You cannot specify --center or --crop with --autocrop.")
|
||||||
|
|
||||||
# check for the output
|
# check for the output
|
||||||
folder, filename = split(args.output)
|
if args.output != '-':
|
||||||
if folder != '' and not exists(folder):
|
folder, filename = split(args.output)
|
||||||
parser.error("The destination folder '{0}' doesn't exist.".format(folder))
|
if folder != '' and not exists(folder):
|
||||||
|
parser.error("The destination folder '{0}' doesn't exist.".format(folder))
|
||||||
|
|
||||||
# calculate stuff
|
# calculate stuff
|
||||||
n = args.zoom_level
|
n = args.zoom_level
|
||||||
@@ -148,7 +149,7 @@ def main():
|
|||||||
print("Pasted {0} of {1}.".format(counter, total), file=sys.stderr)
|
print("Pasted {0} of {1}.".format(counter, total), file=sys.stderr)
|
||||||
print("Done!", file=sys.stderr)
|
print("Done!", file=sys.stderr)
|
||||||
print("Saving image... (this may take a while)", file=sys.stderr)
|
print("Saving image... (this may take a while)", file=sys.stderr)
|
||||||
final_img.save(args.output, "PNG")
|
final_img.save(args.output if args.output != '-' else sys.stdout, "PNG")
|
||||||
|
|
||||||
|
|
||||||
def get_cropped_centered_img_coords(options, tile_size, center_vector, crop, t):
|
def get_cropped_centered_img_coords(options, tile_size, center_vector, crop, t):
|
||||||
|
|||||||
Reference in New Issue
Block a user