def show_image(setter, width, height,<EOL>image_path='<STR_LIT>', image_obj=None, offset=(<NUM_LIT:0>, <NUM_LIT:0>),<EOL>bgcolor=COLORS.Off, brightness=<NUM_LIT:255>):
bgcolor = color_scale(bgcolor, brightness)<EOL>img = image_obj<EOL>if image_path and not img:<EOL><INDENT>from PIL import Image<EOL>img = Image.open(image_path)<EOL><DEDENT>elif not img:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>w = min(width - offset[<NUM_LIT:0>], img.size[<NUM_LIT:0>])<EOL>h = min(height - offset[<NUM_LIT:1>], img.size[<NUM_LIT:1>])<EOL>ox = offset[<NUM_LIT:0>]<EOL>oy = offset[<NUM_LIT:1>]<EOL>for x in range(ox, w + ox):<EOL><INDENT>for y in range(oy, h + oy):<EOL><INDENT>r, g, b, a = (<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:255>)<EOL>rgba = img.getpixel((x - ox, y - oy))<EOL>if isinstance(rgba, int):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if len(rgba) == <NUM_LIT:3>:<EOL><INDENT>r, g, b = rgba<EOL><DEDENT>elif len(rgba) == <NUM_LIT:4>:<EOL><INDENT>r, g, b, a = rgba<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if a == <NUM_LIT:0>:<EOL><INDENT>r, g, b = bgcolor<EOL><DEDENT>else:<EOL><INDENT>r, g, b = color_scale((r, g, b), a)<EOL><DEDENT>if brightness != <NUM_LIT:255>:<EOL><INDENT>r, g, b = color_scale((r, g, b), brightness)<EOL><DEDENT>setter(x, y, (r, g, b))<EOL><DEDENT><DEDENT>
Display an image on a matrix.