Add debug code for image processing