I have a Python program which processes images and save the resulting output to a file. I am receiving the input and output file names via console using input(). But I want to save the output automatically with the file name as something like "input_file_name_out". Note the string "_out" attached to the input file name
This will help me get user input only for Input file names thereby saving little time for the user since he doesn't need to think everytime what should be the output file name
Sample code snippet
if __name__ == "__main__":
in_file = input()
out_file = input()
processed = process_image(in_file,out_file)
Expected code snippet
if __name__ == "__main__":
in_file = input()
# out_file = input() ------Not getting the file name from user thereby supplying only one argument to the below function
processed = process_image(in_file)
# And within the function
def process_image(img):
.
.
.
out_file = img+"_out.jpg" ##### What should come here to achieve my requirement ########
cv2.imwrite(out_file,processed_image)