To turn the 2D array, which contains numerical values close two zero, to PNG we need to scale it first. To do so that follow these steps.
- Find the minimum and maximum values of the input array, and then find their difference.
- Divide the number 255 by the difference that you have found.
- Multiply the data in your array by the result obtained in the second step.
Now, you have the scaled data. To convert it into a picture you can use the following approach.
- Use Flatten Pixmap.vi to turn the obtained 2D array pixmap into 1D array pixmap.
- Give the image data output of Flatten Pixmap.vi to Write PNG File.vi.