xg=max(max(G)); ng=min(min(G)); cg=255/(xg-ng); image(256-cg*(G-ng));