img: [fixup] Small fixes to img script and functions

There was a line that was commented by accident. This has been fixed.

The function check has been simplified from an "if" statement to a
single line.