Split _parse_img into two functions so the function parsing code can be reused
Rework for tests in subdirectories