Add error control in the plugin to make sure the input image is grayscale and the dynamic value is valid.