Snappy - writting .dim to .png or tif file

Hello there I am struggling a lot how to write simple singe band file (ndvi) which I was able to save in .dim to .png format. Do you have by a chance a solution to that?
Also I would like to ask if anyone was able to create the boxplots of values from the images.
I am trying this and had changed the band to np.array and flatten it but still something is wrong as I would like to have 4 bands data one next to each other in a boxplots I am able to generate only one…
Any solutions?

Also the code to create the the png file which I’ve used is following:
n1 = ProductIO.readProduct(‘ndvi_output_20200514.dim’)
outpath_name = ‘C:/Users/eweli/Desktop/NDVI_tutorial/NDVI_tiff/’
snappy.ProductIO.writeProduct(n1, outpath_name, ‘GeoTIFF’)
print(colored(‘Product succesfully saved in:’, ‘green’), outpath_name)

@ewelina_123: You have data_to_plot = ndvi1_flat, ndvi2_flat, but you appear to be using matplotlib where multi-variable boxplots use data_to_plot = [ ndvi1_flat, ndvi2_flat ].