def pil(self, **params_to_override):
from PIL.Image import fromarray<EOL>nchans = self.num_channels()<EOL>if nchans in [<NUM_LIT:0>, <NUM_LIT:1>]:<EOL><INDENT>mode, arr = None, self(**params_to_override)<EOL>arr = (<NUM_LIT> / arr.max() * (arr - arr.min())).astype(np.uint8)<EOL><DEDENT>elif nchans in [<NUM_LIT:3>,<NUM_LIT:4>]:<EOL><INDENT>mode = '<STR_LIT>' if nchans==<NUM_LIT:3> else '<STR_LIT>'<EOL>arr = np.dstack(self.channels(**params_to_override).values()[<NUM_LIT:1>:])<EOL>arr = (<NUM_LIT>*arr).astype(np.uint8)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>return fromarray(arr, mode)<EOL>
Returns a PIL image for this pattern, overriding parameters if provided.