Debugged sampleImageConditionally().