orig = ImagePlus(fi) strName = os.path.basename(fi) strName = strName.split('.')[0] lStr = strName.split('-') l = len(lStr) strNum = lStr[l-1] iNum = int(strNum) orig.setTitle(strNum) cal = orig.getCalibration() strUnit = cal.getUnit() if strUnit == "micron": mu = IJ.micronSymbol strUnit = mu + "m" cal.setUnit(strUnit) orig.setCalibration(cal) orig.updateAndRepaintWindow() # IJ.run(orig, "Enhance Contrast", "saturated=0.35") IJ.run(orig, "16-bit", "") orig.show() outPth = sTifPath + strName + ".tif" IJ.saveAs(orig, "Tiff", outPth) time.sleep(1) orig.close() toc = time.time() elapsed = toc - tic print("analyzed %g images" % i) print("completed in %g sec" % elapsed )