Added cases 5 and 6 for image filtering