I have code which prints the latest file path of an image snapshot that is saved when motion is activated, I'm trying to use this file path as input to the next part of my code which converts the image to leave only the blue blobs. Any help is appreciated, I'm new to code.
#!/bin/bash/python
import os
from subprocess import check_call
path = '/..'
os.chdir(path)
files = sorted(os.listdir(os.getcwd()), key=os.path.getmtime)
newest = files[-1]
if newest == "Thumbs.db":
'newest = files[-1]
newest = [path+"/"+newest]
a = newest
print newest
##### convert to blue blobs
check_call(["sudo","convert","imgIn.jpg", "-posterize","2","imgOut.jpg"])
check_call([ "sudo",'convert', 'imgIn.jpg', '-matte', '(', '+clone', '-fuzz', 57%', '-opaque', 'black', '-transparent', 'blue', ')', '-compose', 'DstOut', '- composite', 'imgOut.jpg'])
How do I use the file path of newest as imgIn.jpg?