image buffer/RGB data should be unsigned chars
include patch by daniel schwen to check if a variable is define
simplify isdef() variable function semantics and add documentation