Dicom Conversion

Hey guys, I’m trying to convert 16-bit dicoms to 8-bit png images using Python, but I can’t get the same effect as ImageJ does when doing my conversion processes. Does anyone know what algorithm ImageJ uses for normalization? Thanks!

The source code is here.