Combines the two processImage functions.