Python gray-scaled image writing

I found really useful the ProductUtils class that contains the method createColorIndexedImage to get a gray-scaled image from a band. I just compared it with what it is obtained in the desktop version of SNAP and one question comes out : the image obtained with the method seems to be the original image after auto-adjusting it to 95% of all the pixels. I verified that this way I can visualize properly the Meris images,while the Sentinel-2 images are displayed only partially. Then I tried to apply the from the examples scripts and it works,displaying and saving a whole single band image. For the colors I set the minimum pixel value with COLOR.BLACK and the maximum with COLOR.WHITE and it works properly even if the processing is quite slow.