How to get values of a categorical grid?

Thanks Paul. I use grdimage -nn+a.