Updated ImageClipper function to accept threshold