adding validation to ensure file paths are correct and quality value is within range