add test function for writing file with img output