def image_convert(fname,saveAs=True,showToo=False):
<EOL>im=scipy.ndimage.imread(fname) <EOL>im=np.array(im,dtype=float) <EOL>cutoffLow=np.percentile(im,<NUM_LIT>)<EOL>cutoffHigh=np.percentile(im,<NUM_LIT>)<EOL>im[np.where(im<cutoffLow)]=cutoffLow<EOL>im[np.where(im>cutoffHigh)]=cutoffHigh<EOL>im-=np.min(im) <EOL>im/=np.max(im) <EOL>im*=<NUM_LIT:255> <EOL>im = Image.fromarray(im)<EOL>msg="<STR_LIT>"%os.path.basename(fname)<EOL>timestamp = datetime.datetime.fromtimestamp(os.path.getctime(fname))<EOL>msg+="<STR_LIT>"%timestamp.strftime('<STR_LIT>')<EOL>d = ImageDraw.Draw(im)<EOL>fnt = ImageFont.truetype("<STR_LIT>", <NUM_LIT:20>)<EOL>d.text((<NUM_LIT:6>,<NUM_LIT:6>),msg,font=fnt,fill=<NUM_LIT:0>)<EOL>d.text((<NUM_LIT:4>,<NUM_LIT:4>),msg,font=fnt,fill=<NUM_LIT:255>)<EOL>if showToo:<EOL><INDENT>im.show()<EOL><DEDENT>if saveAs is False:<EOL><INDENT>return<EOL><DEDENT>if saveAs is True:<EOL><INDENT>saveAs=fname+"<STR_LIT>"<EOL><DEDENT>im.convert('<STR_LIT>').save(saveAs)<EOL>
Convert weird TIF files into web-friendly versions.
Auto contrast is applied (saturating lower and upper 0.1%).
    make saveAs True to save as .TIF.png
    make saveAs False and it won't save at all
    make saveAs "someFile.jpg" to save it as a different path/format